Visual Basic Classic

164K

Solutions

58K

Contributors

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.

Does anyone know of a VB6 addin that can replicate Notepad++'s ability to highlight selected text?

When I have a code window open and I want to see where I've used a variable, I'd for the vb6 IDE's window to highlight the selected text like this:
VBHighlighting.pngThe lighter highlighting is not important - I just want to be able to highlight one block of text and have everything in that code window that matches the block (case sensitive) get highlighted as well.

Anyone know how this can be done - I doubt the built in IDE for VB6 supports this, but hoping someone wrote an add-in... Rather it were free but would consider paying...
0
VB6 with multiple monitors
If you have 2 monitors and you start the VB6 program that has 2 forms Form1 and Form2 and move the program from monitor 1 to monitor 2.
You then click on a button that loads Form2  ( Form2.Show 2 )
Question:
How do I get the Form2 to show on monitor 2 instead of monitor 1.
0
Can VB6 use GPG to encrypt and decrypt files?  If so an example would be appreciated especially decrypting a file
0
RemoteLoginVBS.txtWin10 Task Manager Showing Targeted AppsI work remotely most of the time and use a remote login script to access my corporate PC.

The attached script (sensitive info removed) opens an IE window, navigates to a remote login page, and triggers the link which loads the terminal session which gives me control of my corporate PC.

At this point the terminal session window opens, leaving the previous IE Window open on my local PC.  My first question below is how to minimize this IE Window.

Now to the second question.  Unfortunately the default settings for the terminal session window (I either can't find where those are set or I don't have access to them) cause the terminal session window to open in, let's call it, a 90% useable-size window.  This causes multiple scroll bars in the terminal session window to clutter up the UI, and keeps 'close' buttons, taskbar, etc, out of direct access in the terminal session (user needs to scroll).  I correct this by navigating my local PC (runs 64Bit Windows 10) to its Task Manager, selecting the expand option on the app which runs the terminal session, and selecting 'maximize'.  My second question is how to have the script take care of this.

Sample login script and image of targeted apps in Task Manager attached.

Two Questions:

Q1.  How do I modify the attached script to minimize the IE Window after the terminal session has opened (or after some delay; which I know how to create)?

Q2.  How do I modify the attached script …
0
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?
0
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
part1,10
part1,10
part1,10
part1,10
part1,10
part1,10
part2,10
part3,10
part4,10
part1,10
part1,10
0
cannot add the component 'Microsoft common windows control 6.0 sp6' to VB6 on a windows 7 64 bit system .  see attachment
vb6-compon.jpg
0
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!

case SERVICE_CONTROL_SHUTDOWN: // 5
  pService->FireControl(svcCtrlShutdown);
  SetStatus (SERVICE_STOPPED);
  break;
CODE_UPLOAD14561252001.zip
0
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.
C--Users-x0077267-Documents-2-on-ea.pptx
0
Webbrowser1 vb6 only navigates to a url once during session.  Need VB6 code to clear the cache to see if that fixes the issue.
0
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
VB6-Flex-grid.jpg
0
what would be the easiest way to validate a pattern in text1.text vb6.
the pattern would be    AA##AA###

A=A-Z
#=0-9
0
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
0
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.
0
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!
0
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:
https://www.experts-exchange.com/questions/20923876/How-to-get-volume-settings.html

https://www.experts-exchange.com/questions/26386284/VB-Script-detect-if-volume-is-muted-on-Windows-Mixer.html
I tried the above post for the unmute with the registry for the master mute found here:
Computer\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\MediaCategories\{185FEDE4-9905-11D1-95A9-00C04FB925D3}\Display
However it doesn't seem to change when it's muted or unmuted.  It stays at 00 00 00 00
Code:
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"
Else
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.
http://allapi.mentalis.org/vbexamples/vbexample.php?vbexample=VOLUME&category=SOURCE

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) …
0
export crystal report to pdf from vb6
0
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
Next
Set oItem = Nothing
Set oItems = Nothing
Set oWMI = Nothing
End Sub

Open in new window

0
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!"
    Else
        MsgBox "Not found!"
    End If
End Sub
0
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.

Thanks!
0
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
            Else
                Report.Database.Tables.Item(2).SetDataSource Adodc2.Recordset, 3
 …
0
From VB6 any code for create a self extracting zip exe???

In planet-source-code are this code:
https://www.planet-source-code.com/vb/scripts/ShowCode.asp?txtCodeId=3147&lngWId=1

But is lost the code... Any have how create a self extrancting zip from a programa created by vb6?
0
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!
Test-Drawing_v2007.dwg
Test_RGM.vbp
Test_form_RGM.frx
Test_form_RGM.frm
0
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...)
1
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 ...
Test_form_RGM.frm
Test_form_RGM.frx
Test_RGM.vbp
Test-Drawing_v2007.dwg
0

Visual Basic Classic

164K

Solutions

58K

Contributors

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.