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
22
votes
3 answers

how do I express the term if x is integer in VBA language?

how do I express the term if x is integer in VBA language ? I want to write a code that does something if x is integer and does something else if its not with vba excel. Sub dim() Dim x is Variant 'if x is integer Then 'Else: End Sub
excel34
  • 419
  • 3
  • 7
  • 9
22
votes
11 answers

ReDim Preserve to a multi-dimensional array in VB6

I'm using VB6 and I need to do a ReDim Preserve to a Multi-Dimensional Array: Dim n, m As Integer n = 1 m = 0 Dim arrCity() As String ReDim arrCity(n, m) n = n + 1 m = m + 1 ReDim Preserve arrCity(n, m) Whenever I…
Ouerghi Yassine
  • 1,835
  • 7
  • 43
  • 72
22
votes
8 answers

Cancelling a long running process in VB6.0 without DoEvents?

Is it possible to cancel out of a long running process in VB6.0 without using DoEvents? For example: for i = 1 to someVeryHighNumber ' Do some work here ' ... if cancel then exit for end if next Sub btnCancel_Click() …
Stuart Helwig
  • 9,318
  • 8
  • 51
  • 67
22
votes
2 answers

Error Handler - Exit Sub vs. End Sub

Why would I want to get out of an Error Handler (after handling) with an Exit Sub instead of just letting it go to the End Sub? I'm sure it's simple. I just don't understand. Thanks for any help. Example: Public Sub SubA() On Error Goto…
RNamo
21
votes
2 answers

Equivalent C# statement for this VB6 operation creating problems

I have this code line in VB: Dim Sqrt As Double Sqrt = Radius ^ 2 - (CenterX - X) ^ 2 The parameters in the statement above are being passed the values below: X= -7.3725025845036161 Double CenterX =0.0 Double Radius= 8.0 …
Apoorv
  • 2,023
  • 1
  • 19
  • 42
21
votes
3 answers

What do ! and # mean when attached to numbers in VB6?

I have recently come across numeric literals such as 10! and 50# in Visual Basic programs. Could anyone tell me what these punctuation marks mean?
Brian Hooper
  • 21,544
  • 24
  • 88
  • 139
21
votes
2 answers

VBA : save a file with UTF-8 without BOM

it's probably sthg simple, here is what I tried : Set objStream = CreateObject("ADODB.Stream") Set objStreamNoBOM = CreateObject("ADODB.Stream") With objStream .Open .Charset = "UTF-8" .WriteText "aaaaaa" …
Julien
  • 3,743
  • 9
  • 38
  • 67
21
votes
4 answers

VBA for Excel throws "Object variable or with block variable not set" when there is no Object

In my code, I have declared these variables: Dim Field_Name, Datatype, row As Integer Then, inside a For loop, I have this code: Field_Name = Worksheets(i).UsedRange.Find("Field Name").Column Datatype =…
wardzin
  • 373
  • 2
  • 4
  • 12
21
votes
2 answers

Display Progress Bar at the Time of Processing

If I am getting data from the database from start time to end time, during that time (of processing / querying), I want to display a progress bar (something like, “Processing, please wait”). How can I do this?
Jash
20
votes
9 answers

Select Case True

Apparently this used to be a way in VB6 and VBA to short circuit and execute the first true case: Select Case True End Select Is this still in use (VB.NET) ?
Otávio Décio
  • 73,752
  • 17
  • 161
  • 228
20
votes
7 answers

How can I determine the Windows version from a VB 6 app?

I want to detect any Windows versions from 95 to Win 7. I also would like to display if the OS is 32-bit or 64-bit. That's it; it's that simple. :) What code could I use to do this from within a VB 6 application?
SOF User
  • 7,590
  • 22
  • 75
  • 121
20
votes
9 answers

Check if a record exists in a VB6 collection?

I've inherited a large VB6 app at my current workplace. I'm kinda learning VB6 on the job and there are a number of problems I'm having. The major issue at the moment is I can't figure out how to check if a key exists in a Collection object. Can…
user4315
  • 4,775
  • 5
  • 23
  • 9
20
votes
2 answers

How to check type of Object in VB 6 ? - I do not want to use 'TypeOf' method

How to check type of object in VB 6.0 we have to modify existing code to use 'typeof' method, Is there any method like moving cursor over object variable or like quick watch where I can see its type. I know following method but I do not want to use…
Avinash
  • 371
  • 1
  • 5
  • 14
20
votes
5 answers

What are the Command Line options for the VB6 IDE (Compiler)

I'm doing batch compiling and need to specify the output directory.
Clay Nichols
  • 11,848
  • 30
  • 109
  • 170
20
votes
7 answers

Using Subversion with Visual Basic 6

My team is moving from Visual SourceSafe to Subversion soon, while developing/supporting a legacy project in Visual Basic 6.0, so I have a couple of questions: What's the best tool for Subversion IDE integration in Visual Studio 6? (or is it not…
Jonathan Rauch
  • 693
  • 1
  • 8
  • 18