vb6

How to create txt file

删除回忆录丶 提交于 2019-12-30 03:28:25
问题 I have to create a txt file so with some large content in VB6. Can anybody help me out on this and please tell me the references also. 回答1: This is how you can create a text file in VB6 Dim iFileNo as Integer iFileNo = FreeFile 'open the file for writing Open "C:\Test.txt" For Output As #iFileNo 'please note, if this file already exists it will be overwritten! 'write some example text to the file Print #iFileNo, "first line of text" Print #iFileNo, " second line of text" Print #iFileNo, ""

Passing parameters in Shell command in VB 6

眉间皱痕 提交于 2019-12-29 09:08:17
问题 I have 2 EXEs in VB 6. EXE 1 calls the other EXE2 through shell command EXE1 : Shell(PathName\EXE2,0) Now all I want is to pass a string type variable to EXE2 which I wish to receive in that EXE2. How can I achieve the same? Thanks in advance 回答1: Simply append the string (possibly quoted) to the end of the filename: Shell("""PathName.exe"" wibble", vbNormalFocus) or: Shell("""PathName.exe"" ""wibble"" ""wibble 2""", vbNormalFocus) This value can then be read in the other application using

How do I call a visual basic 6.0 method in c#?

杀马特。学长 韩版系。学妹 提交于 2019-12-29 08:46:10
问题 I would like to call a method which is written in visual basic 6.0 from c# (visual studio 2008). Is it possible? How would I do it? 回答1: Easiest way to do it is to just compile the VB6 code as an ActiveX DLL. Then you can reference the DLL in your .net project. (Visual studio can reference ActiveX DLLs properly.) 回答2: Compile your VB6 DLL as activex dll Register it using -> regsvr32 "Full Name And Path of newly compiled vb6 dll".(use Run Dialog or Command Prompt to register) In .net Add

Why is my Access database not up-to-date when I read it from another process?

吃可爱长大的小学妹 提交于 2019-12-29 07:52:09
问题 In my application I do the follwing things: Open a Access database (.mdb) using Jet/ADO and VB6 Clear and re-fill a table with new data Close the database Start another process which does something with the new data. The problem is that sometimes the second process cannot find the new data. Sometimes the table is just empty, sometimes RecordCount > 0, but EOF is true and I cannot do a MoveFirst or MoveNext. In a nutshell: All kinds of weird things. My current workaround is adding a delay

Reset autonumber seed

雨燕双飞 提交于 2019-12-29 07:42:11
问题 I have a VB6/Access application that occasionally encounters a problem with wrong autonumber field seed. Lets say there is a table MYTABLE with an autonumber field ID (that is also the primary key). Lets say at the moment the maximum value of ID is 1000. When the application inserts a new record (ID value is not provided explicitly), for some reason it decides that the next autonumber field value is 950 (and not 1001 as it should be) - so a primary key violation error occurs. I found a KB

Reset autonumber seed

风流意气都作罢 提交于 2019-12-29 07:42:03
问题 I have a VB6/Access application that occasionally encounters a problem with wrong autonumber field seed. Lets say there is a table MYTABLE with an autonumber field ID (that is also the primary key). Lets say at the moment the maximum value of ID is 1000. When the application inserts a new record (ID value is not provided explicitly), for some reason it decides that the next autonumber field value is 950 (and not 1001 as it should be) - so a primary key violation error occurs. I found a KB

Will a Visual Basic 6 program run on a 64-bit machine?

核能气质少年 提交于 2019-12-29 07:35:17
问题 I have a program built with VB6 and using some 32-bit DLL's. Will this program run on a 64-bit machine? This page suggests that it should run fine on the Windows on Windows layer, but what about the DLL's? 回答1: Yes , both the VB 6 program and the DLLs will work just fine on a 64-bit version of Windows. Since both are 32-bit, they will run under the Windows-on-Windows 64 (WoW64) subsystem, which effectively emulates a 32-bit operating system on the 64-bit versions of Windows. I've run many

Why is an event firing during compilation of a VB6 app?

我只是一个虾纸丫 提交于 2019-12-29 06:55:31
问题 I am trying to compile a VB6 application, but it fails with the error, "Run-time error '91': Object variable or With block variable not set". It turns out the Resize event of a user control is firing during compilation and calling code that attempts to access an object that has not been instantiated yet. Why is an event firing during compilation and is there any way to stop it? Edit : I had some code here, but it's not relevant. The problem results from the fact that UserControl code (namely

What is the difference between “Null” and “Nothing” in VB6?

十年热恋 提交于 2019-12-29 06:50:31
问题 I have a recordset like this: Dim rs as Recordset Set rs as New Recordset '... a lot of coding ... if Err.Number <> 0 Then ' oops, something gone wrong! If rs.State <> adStateClosed Then rs.Close Set rs = Nothing end if ' I want to evaluate if rs is Nothing, or Null if rs is Nothing then ' this doesn't throw errors, and works well :D end if if rs is Null then ' this throws an error of "types not compatible" end if if rs = Null then ' this throws an error of "types not compatible" end if if

Store two Queries result in third variable

陌路散爱 提交于 2019-12-28 07:08:48
问题 What's wrong with this code: Visual Basic 6.0 With access 2007 Private Sub Command1_Click() Dim Sell_tbl, Stock_Bottle, res As String Sell_tbl = "SELECT Sum((Quantity)*12) FROM Sell_Detail Where Cateogry='Large'" Stock_Bottle = "Select Sum(No_Of_Bottle) FROM Add_Bottle Where Cateogry='Large'" res = ((Sell_tbl) - (Stock_Bottle)) Adodc1.RecordSource = Sell_tbl Adodc1.Refresh Adodc1.Caption = Adodc1.RecordSource End Sub Type Mismatch Error I try to convert its result in other data type but it