Questions tagged [vb6]

Visual Basic 6.0 (VB6) was the final COM-based version of the VB programming language and IDE, last updated in 2004. It is the predecessor to the modern VB.NET.

Visual Basic 6.0 () is the third generation event-driven programming language and integrated development environment (IDE) from Microsoft for its COM programming model. It is also considered a relatively easy programming language to learn and use, because of its graphical development features and BASIC heritage.

The final release of the COM-based Visual Basic was version 6 in 1998. It was last updated in 2004 through Service Pack 6.

  • The designated successor language is . For things like writing COM addins for Microsoft Office you would use or .
  • Support for the VB6 IDE ended on April 8th, 2008.
  • The runtime is supported as part of Windows Vista, 7, 8, 8.1 and 10 and Windows Server 2008, 2012 including R2 and 2016.

Resources:

10799 questions
20
votes
1 answer

RegAsm - When is the /codebase option applicable?

I have a COM-visible DLL written in C# that I would like to use in a VB6 application. I have two main use cases of the DLL and am wondering when the /codebase option is applicable and when it is better to register in the GAC. Use cases: The DLL…
davidk
  • 784
  • 1
  • 6
  • 22
20
votes
1 answer

ReDim Preserve "Subscript Out of Range"

I am trying to move data from 2 Double Arrays to 2 different Double Arrays. I'm not sure what the size is going to be because I am taking a randomized sample out of the first arrays and putting it into the 2nd arrays. When I add the ReDim…
atomant
  • 339
  • 1
  • 2
  • 9
20
votes
2 answers

How can I subtract a previous row in sql?

What should I query if I wanted to subtract the current row to the previous row. I will use it on looping in vb6. Something Like this: Row 1 2 3 4 5 On first loop value 1 will not be deducted because it has no previous row, which is ok. Next loop…
ImTheBoss
  • 337
  • 1
  • 2
  • 13
20
votes
3 answers

Get last element of string array in vb6?

How might one retrieve the last element of a string array in visual basic 6? I'm dealing with filenames with multiple dots which are split into an array, and I want to manipulate only the extension. The following code works, but has a hardcoded…
matt wilkie
  • 17,268
  • 24
  • 80
  • 115
19
votes
4 answers

How do I check for an object being Nothing in VB6?

In my VB6 application I have an array of objects declared thus... Dim MyArray() as MyClass This array is filled in as processing goes on Set MyArray(element) = passed_object and as elements are no longer wanted, Set MyArray(otherelement) =…
Brian Hooper
  • 21,544
  • 24
  • 88
  • 139
19
votes
3 answers

How to destroy an object

It seems that Set Object = Nothing didn't destroy the Fs Object in this code: Sub Test2() Dim Fs As New FileSystemObject Set Fs = Nothing MsgBox Fs.Drives.Count ' this line works End Sub The last line works with no errors!. thats mean…
Fadi
  • 3,302
  • 3
  • 18
  • 41
19
votes
1 answer

VBA Garbage Collector Details

I've found myself having to write some VBA code recently and just wondered if anyone had ever come across any details on how the VBA garbage collector works? The .Net GC is very well-documented indeed but I can't find a single shred of detail on the…
Jon Artus
  • 6,268
  • 11
  • 42
  • 41
19
votes
1 answer

Default value for function parameters in VB6

How to specify default value for a parameter in VB6?
rkg
  • 5,559
  • 8
  • 37
  • 50
18
votes
7 answers

User Defined Type (UDT) as parameter in public Sub in class module (VB6)

I've tried to solve this problem, but can't find any solution. I have a UDT defined in a normal module, and wanted to use it as parameter in a Public Sub in a Class Module. I then get a compile error: Only public user defined types defined in…
cfischer
  • 24,452
  • 37
  • 131
  • 214
18
votes
4 answers

What is the reason for not instantiating an object at the time of declaration?

I had to delve into some VB6 code recently and I saw this pattern all over the place: dim o as obj set o = new obj Why not this? dim o as new obj I remember from 15 years ago that there was a good reason for this, but I can't remember what it was…
AngryHacker
  • 59,598
  • 102
  • 325
  • 594
18
votes
3 answers

Self Inspection of VB6 UDTs

I have a feeling the answer to this is going to be "not possible", but I'll give it a shot... I am in the unenviable position of modifying a legacy VB6 app with some enhancements. Converting to a smarter language isn't an option. The app relies on…
Dan
  • 379
  • 3
  • 12
18
votes
4 answers

Visual Basic Open URL with Default Browser

Edit For VB 6 End Edit Hey this seems like it should be an easy fix and I don't particularly like the Visual Basic language, but how would I open a URL in the default web browser, using code? Edit Why do I keep getting this error? A call to PInvoke…
rolling_codes
  • 15,174
  • 22
  • 76
  • 112
18
votes
4 answers

reading xml files in vb6

I know it is easier to read xml files in vb.net but since our appl is still on vb6, i need a work around. but somehow, i am stuck. also i do not have control over the xml file as it is being generated from another application. Short code from the…
Ubaid
  • 269
  • 1
  • 4
  • 15
18
votes
4 answers

Python: Where does if-endif-statement end?

I have the following code: for i in range(0,numClass): if breaks[i] == 0: classStart = 0 else: classStart = dataList.index(breaks[i]) classStart += 1 classEnd = dataList.index(breaks[i+1]) classList =…
tmighty
  • 10,734
  • 21
  • 104
  • 218
18
votes
17 answers

How do I Merge two Arrays in VBA?

Given Dim arr1 As Variant Dim arr2 As Variant Dim arr3 As Variant arr1 = Array("A", 1, "B", 2) arr2 = Array("C", 3, "D", 4) Question What kind of operations can I perform on arr1 and arr2 and assign the result to arr3 getting something like…
Kevin Boyd
  • 12,121
  • 28
  • 86
  • 128