Visual Basic Classic





Visual Basic is Microsoft’s event-driven programming language and integrated development environment (IDE) for its Component Object Model (COM) programming model. It is relatively easy to learn and use because of its graphical development features and BASIC heritage. It has been replaced with VB.NET, and is very similar to VBA (Visual Basic for Applications), the programming language for the Microsoft Office product line.

Share tech news, updates, or what's on your mind.

Sign up to Post

When installing a apps on Window 10 and run, it hang up and return the following messsage..

Any idea ?

Faulting module path: C:\KJTech\Guardian\TABCTL32.OCX
Ensure you’re charging the right price for your IT
Ensure you’re charging the right price for your IT

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden using our free interactive tool and use it to determine the right price for your IT services. Start calculating Now!

One pc in network must write to a random file, on a shared map ,   to a specific record nummer one string in a field  without closing the file it will do that on a event or command  , thus update that record with new string
Other Pc must open that file, keeps it open, and reads every 2 second that record, if string has value
it will read it and sets record to zero spaces and update file
How  to do this without conflict ???
I am going to run a vb6 app on many machines .  I only want the program to be open on one pc at any given time.  Any suggestions on how to program that?
quickest way to sum part qty's in a listview.  Any idea what the quickest way to sum the below listview in vb6?
Part, qty
cannot add the component 'Microsoft common windows control 6.0 sp6' to VB6 on a windows 7 64 bit system .  see attachment
Need Recompiled ntsvc.ocx to process shutdown event.
According to a question NTSvc.ocx won't process shutdown event Posted on 2003-07-17asked by bartsmit marked resolved by Biffo mods need to be done to NtsvcCtl.cpp as per lines bellow.
and recompiled. Thank you!

i have a pdf that is 8.5 x11. in this pdf there 2 framed boxes with text and barcodes in the framed boxes.  the box is 6.5 by 4 inches.  I have a piece of paper 6.5 by 4.  how can I print that pdf on that paper so it fits .  i attached a pptx as an example.  I can not send the pdf to much personal info on it.  there would be many sheets in each pdf also.  I would like to see if there is a way to do it in vb6 if possible  or some other way.
Webbrowser1 vb6 only navigates to a url once during session.  Need VB6 code to clear the cache to see if that fixes the issue.
How do I prevent the end user from double clicking on row 0 on the flexgrid  in vb6 and changing the text?
see attachment[embed=file 1427573
what would be the easiest way to validate a pattern in text1.text vb6.
the pattern would be    AA##AA###

OWASP: Forgery and Phishing
LVL 13
OWASP: Forgery and Phishing

Learn the techniques to avoid forgery and phishing attacks and the types of attacks an application or network may face.

any idea why this crashes in VB6
i have the "windows script host object model" reference added
getting error  "user-defined type not defined"

Private Sub Command1_Click()
Dim ww As New WshworkNet
ww.SetDefaultPrinter ("LabelPrinter") ' Your printer name
Set ww = Nothing
End Sub
I have a vb6 flexgrid that  can enter values into 2 columns and tab through them.  each time I tab It run a script to validate the 2 columns.  the problem is if I enter values and then click away instead of tabbing then the calculation event does not trigger.  any idea how to trigger the event when I click away or lose focus.
I have a vb6 program that reads from a *.log file that is being written to via TelNet.  Can that cause records to not be written by TelNet and, if so, how can I avoid that?  

Thank you!
Using Visual Basic 6 on the Windows 10 pro version 1809 I would like to automatically unmute the volume and set the volume level to 100% of the pc.

I tried this post only to not have any error messages but did it did not work either:
I tried the above post for the unmute with the registry for the master mute found here:
However it doesn't seem to change when it's muted or unmuted.  It stays at 00 00 00 00
Private Sub Command1_Click()
Dim WSHShell, regkey, regval
Set WSHShell = CreateObject("WScript.Shell")
regkey = "HKLM\System\CurrentControlSet\Control\MediaCategories\{185FEDE4-9905-11D1-95A9-00C04FB925D3}\Display"
regval = WSHShell.RegRead(regkey)
If regval(0) = 1 Then
MsgBox "muted"
MsgBox "NOT muted"
End If
End Sub

The below works but does not adjust the original volume settings but rather uses it as the starting volume (max).  Also the mute/unmute does not work.

I am also using on board audio only (no speakers or headphones attached)

Or if someone could please tell me where, in the registry the volume level and status (mute/mute) …
export crystal report to pdf from vb6
Hi Experts,  I copied a code from net and the code is able to obtain Hard Drive Serial number in Windows 10 but not in Windows Xp. Is there anyone who can help me using the code below to get the HDD S/N in Windows Xp? Any help please... thanks!

Private Sub Command2_Click()
'Do not disAble
Dim oWMI As Object
Dim sComputer As String
Dim oItems As Object
Dim oItem As Object
'your Computer
sComputer = "."
' WMI-Objekt
Set oWMI = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" _
  & sComputer & "\root\cimv2")
' WMI-query
Set oItems = oWMI.ExecQuery("Select * from Win32_DiskDrive")
For Each oItem In oItems
  On Error Resume Next
  List1.AddItem "Index: " & oItem.Index
  List1.AddItem "InterfaceType: " & oItem.InterfaceType
  List1.AddItem "DeviceID: " & oItem.DeviceID
  List1.AddItem "Model: " & oItem.Model

 List1.AddItem "SerialNo: " & oItem.SerialNumber
  List1.AddItem "-------------------------------------" & vbCrLf
  On Error GoTo 0
Set oItem = Nothing
Set oItems = Nothing
Set oWMI = Nothing
End Sub

Open in new window

I want to continuously searching all files base on the code below. The code below will stop once it found the item. How to improve the code to  let the searching search the entire drive. Thank you!

Option Explicit
Private Declare Function SearchTreeForFile Lib "imagehlp" (ByVal RootPath As String, ByVal _
InputPathName As String, ByVal OutputPathBuffer As String) As Long
Private Const MAX_PATH = 260

Private Sub Command2_Click()
    Dim strPadPath As String
    Dim lngAmIHere As Long
    'create a buffer string
    strPadPath = String(MAX_PATH, 0)
    'Typically, lngAmIHere will return 1 if successfull, 0 if not
    lngAmIHere = SearchTreeForFile("C:\Program Files\WebPrinterActivator\", "WebPrint.exe", strPadPath)
    'MsgBox Trim(strPadPath)
    If lngAmIHere <> 0 Then
        'MsgBox "Located file at " + Left$(strPadPath, InStr(1, strPadPath, Chr$(0)) - 1)
        MsgBox "Found!"
        MsgBox "Not found!"
    End If
End Sub
Hello, All.

OK, what used to work, no longer work.
A multiple row insert, will now only, insert all into a single field.

environment: Windows 10 Pro / IIS
inserting into a Microsoft Office Access Database ACCDB
(This is a site for the intranet, and not for the internet. Which is the reason for using the access database)

Code, that used to work.

The form has all TEXTAREA's that are feeding into the insert form.

arrMN = Split(Request.Form("MediaName"), vbCrLf)  
arrMF = Split(Request.Form("MediaFile"), vbCrLf)  
arrMB = Split(Request.Form("MediaBand"), vbCrLf)  
for i=0 to uBound(arrMN)
  Set objDoubleInsert=CreateObject("ADODB.Command")  
  objDoubleInsert.CommandText = "INSERT INTO EVMediaServer (MediaName, MediaFile, MediaBand) VALUES (?,?,?)"  
  objDoubleInsert.Parameters.Append objDoubleInsert.CreateParameter("@MediaName", 200, 1, 255, arrMN(i)) 
  objDoubleInsert.Parameters.Append objDoubleInsert.CreateParameter("@MediaFile", 200, 1, 255, arrMF(i))  
  objDoubleInsert.Parameters.Append objDoubleInsert.CreateParameter("@MediaBand", 200, 1, 255, arrMB(i))  

Open in new window

before, this code used to create as many rows as I had in the fields.
But now, all of it is inserted into ONE ROW, and all the lines are in one column.

What is going on?
Thanks for any and all assistance on this one.

I created the following code to open an Excel file and select a particular sheet based on the Property Code that was previously copied into the clipboard.  HOWEVER, it stay minimized and blinking on my bottom toolbar.  I googled and try adding the 3 lines starting with Set MyObj=CreateObject("WScript.Shell, but that had no effect.  Any suggestions to bring it to the forefront and maximized.  Note, I start the whole process from a button in a Filemaker dbase layout so Filemaker is in the forefront and unfortunately remains there.  Thank you.

Dim xlApp, xlWb

Set xlApp = CreateObject("Excel.Application")
xlApp.Visible = True
Set xlWb = xlApp.Workbooks.Open("N:\EXCEL\Files\SHARED TOOLS\Sales Reports\SALES REPORTS.xlsm")

xlApp.Run "'" & xlWb.Name & "'!SelectSheet"

Set MyObj=CreateObject("WScript.Shell")
myobj.appactivate "Microsoft Excel"
set myobj = nothing

'if the macro takes arguments, use:
'xlApp.Run "'" & xlWb.Name & "'!NameOfMacro", "Arg1", "Arg2", "Arg3"

'xlWb.Close True
Set xlWb = Nothing
Set xlApp = Nothing
Learn Ruby Fundamentals
LVL 13
Learn Ruby Fundamentals

This course will introduce you to Ruby, as well as teach you about classes, methods, variables, data structures, loops, enumerable methods, and finishing touches.

From the reading pane of Outlook, I would like to quickly copy the contents (body and header) of a highlighted email messages to be able to paste into a work order system.

Is there a way to do this with Quick Steps or would I need a macro?

I can semi-manually do this by hitting Reply then CTRL+A and erasing my signature at the top of the reply, but it gets tedious.
If there is a way to reply without Signature when using the macro/quick step (without changing my signature preferences), that would be ideal.

I am a newbie with VB6 and Crystal, so I apologize for my simple question.

I am trying to integrate VB6 and Crystal 11.5 and I can do everything I want if I use the Access db.  We are now switching to SQL db and I can get the reports to work fine on the Dev machine, but not on the Deployed Computers.
Is there a tool to use to tell me what control or dll is missing?

I am using RDC with ADO and I keep getting a 429 error Axtivex cannot create object.
I've registered all the dlls that I know of.

Dim crxApplication As New CRAXDRT.Application
Public Report As New CRAXDRT.Report

 ConnectionString = "Provider=SQLOLEDB.1;DSN=" & SQLServerName & ";" & "Password=" & SQLPassword & ";Persist Security Info=True;User ID=" & SQLUsername & ";Initial Catalog=LimitlessDailyTransactions;Data Source=" & SQLServerName
            ConnectionString2 = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & DB & ";Persist Security Info=False"
            Adodc1.ConnectionString = ConnectionString
            Adodc2.ConnectionString = ConnectionString2
            Adodc1.Refresh 'sql DailyTransactions
            Adodc2.Refresh  'xl.mdb
            Set Report = crxApplication.OpenReport(DatabaseFolderLocation & ReportName)
            Report.Database.Tables.Item(1).SetDataSource Adodc1.Recordset, 3
            If BolSingleTable = True Then
                Report.Database.Tables.Item(2).SetDataSource Adodc2.Recordset, 3
From VB6 any code for create a self extracting zip exe???

In planet-source-code are this code:

But is lost the code... Any have how create a self extrancting zip from a programa created by vb6?
I have been puzzled by a visual basic program 6 that runs outside of autocad 2007 that I wrote, and that works on all of my computers except my home computer.

I uploaded the visual basic file and the sample autocad 2007 file.  The VB6 file should create a new line in the drawing file - but it fails on a line of code.  It works fine on our office computers!
It's 20 years dead, but I'm still learning it... just created my first DLL (needless to say I'm not a programmer... well maybe an Amateur programmer which is a "promotion" from what I used to say).

This DLL has a variety of string functions I created that I would like to make more easily referenced.  Right now, I add the reference in the project and then I have to "Dim MyDLL As New MyDLLs.ClassModuleName" which is generally fine... but now, if I want to apply one of my DLLs functions to a string, I have to do something like:

ThisString = MyDLLs.InvertCase(ThisString)

I'd like to be able to reference it with

ThisString = InvertCase(ThisString)

Basically treating the InvertCase function as a "local" function

Is this possible?  On one hand I can see it not being so, but I'm hoping...

Also, on a related note, I was thinking about putting SQL statements as constants into a DLL - does that make sense?  The idea being that I could have MYSQL.DLL and MSSQL.DLL where the MySQL version of the SQL statements was stored and MYSQL.DLL and the Transact-SQL statements were stored in the MSSQL version... problem is, the DLLs would have to be loaded conditionally - if using a MySQL database, load MYSQL, for example.  Though I suppose if I DIM SQLs As New MySQL vs DIM SQLs AS New MSSQL I could then reference SQLs.Statements.GetUsers?

(Haven't tried it with constants so it might not even work...)
My visual basic program that operates on an open autocad 200 drawing throws an error when I try to create a light weight polyline.  

I am debugging the program right now but cant get past this error - any help is appreciated.

*** Edit by Scott Fell, EE Moderator;  Files and note below from the Author ***
Uploaded a test Autocad 2007 file (Test_Drawing_v_2007.dwg), then three files comprising a visual basic 6 program, (Test_) ;RGM.vbp, RGM.frx, RGM.frm.

On my home computer the program will not create the LWPolyline - but it will work on my other computers - same base setups.

.. Any hints on a solution gratefully accepted ...

Visual Basic Classic





Visual Basic is Microsoft’s event-driven programming language and integrated development environment (IDE) for its Component Object Model (COM) programming model. It is relatively easy to learn and use because of its graphical development features and BASIC heritage. It has been replaced with VB.NET, and is very similar to VBA (Visual Basic for Applications), the programming language for the Microsoft Office product line.