Click here to Skip to main content
15,880,972 members
Everything / Programming Languages / Visual Basic 6

Visual Basic 6

VB6

Great Reads

by Chris Boss
Visual Basic 6.0 just doesn’t want to disappear. Why ? Likely many have written vital applications using VB 6.0 and Visual Basic dot.net is so different that it is not a viable option.
by Duncan Edwards Jones
Part 2 in the series showing how to write a debugger in VB
by Len Holgate
This example COM component provides 3 COM objects for using the Win32 Mailslot IPC mechanism. The component may be useful if you need to communicate from VB using Mailslots.
by kirkaiya
A very simple, XAML-based month-view calendar that shows appointments, exposes events, and allows dragging appointments in the current month.

Latest Articles

by ToughDev
How to convert OFT to .NET Windows Form in VS
by Paul Aurelian Gagniuc
This article shows how to mix two signals into a third, in variable proportions.
by FranciskaR
More on fluid simulation
by FranciskaR
A new approach to fluid simulation

All Articles

Sort by Score

Visual Basic 6 

4 Sep 2019 by Chris Boss
Visual Basic 6.0 just doesn’t want to disappear. Why ? Likely many have written vital applications using VB 6.0 and Visual Basic dot.net is so different that it is not a viable option.
21 Oct 2003 by Duncan Edwards Jones
Part 2 in the series showing how to write a debugger in VB
10 Apr 2002 by Len Holgate
This example COM component provides 3 COM objects for using the Win32 Mailslot IPC mechanism. The component may be useful if you need to communicate from VB using Mailslots.
21 Aug 2009 by kirkaiya
A very simple, XAML-based month-view calendar that shows appointments, exposes events, and allows dragging appointments in the current month.
28 Jul 2000 by Len Holgate
The ATL OLE DB Provider templates appear to rely on the fact that your data is kept in a simple array, but that's not really the case at all!
7 Jan 2008 by S.SRIVATHSAN
Implementation Nhibernate concept in VB.NET
18 Jun 2012 by Mark Kruger
API which shows a Selection Overlay and notifies the caller when it's resizing and notifies the final rectangle.
8 Jun 2021 by FranciskaR
More on fluid simulation
16 Jan 2016 by Glenn Lloyd
This is an alternative for "A Simple List Class for VBA Projects"
7 Sep 2018 by Clifford Nelson
This is a tip that has the code for selecting an Excel file and sheet for import into Microsoft Access. This includes the code required to browse for a file, and populate a ListBox with the sheets of the Excel Workbook, and the code to import an Excel spreadsheet.
17 Feb 2011 by Nish Nishant
The closest C# equivalent is Array.Resize but even that creates a new array and copies over the old array into the new array.If you want an array-like collection that can grow as required, use List. That would be a more .NET-ish way of doing things.When moving from classic VB to...
31 May 2011 by OriginalGriff
This is the fifth question on the same theme today: If you want answers, it really helps if you let us see the code fragment that the compiler is complaining about.Otherwise we have to work out where you are, use our psychic powers to work out your IP address, then hack into you PC to find...
28 Jun 2016 by David A. Gray
A reference chart that doubles as the engine behind a data structure mapper
20 Mar 2022 by Paul Aurelian Gagniuc
This article shows how to mix two signals into a third, in variable proportions.
5 Aug 2000 by Konstantin Boukreev
Describes an ActiveX Control to use OLE Automation to set an object's properties.
8 Mar 2011 by Аslam Iqbal
Very simple way to move a form holding down mouse button
16 Mar 2011 by charles henington
This method was converted to VB from C# but I believe to be much easier, althought it does not allow the F5 Key as yours does. Private panel1 As New Panel() Private canMove As Boolean Private currentPosition As Point Public Sub New() ...
7 Oct 2011 by LaxmikantYadav
Using BlockInput(), You can not diasable the specific key becouse it will block the all input events of the system. Look Here -> http://msdn.microsoft.com/en-US/library/ms646290.aspx[^]If you want suspress specific key then handle the events of keyboardand do the following inside the...
22 Aug 2012 by Christian Graus
You said it all. They used to use VB6. They are morons. I am in the same hell, magic values, no use of null, etc. No, they are wrong.
4 Sep 2012 by Dave Kreskowiak
You have to rewrite by hand. There is no conversion tool to go backwards, there are no namespaces in VB6 and you better know VB6 and your .NET code inside and out.You're going to be doing a ton of PInvoking of Win32 functions in VB6 to rewrite this code.No, nobody is going to do this...
18 Sep 2012 by Wes Aday
Posted as a solution to remove from unanswered list(Y * 0x10000) | (X & 0xffffL)
15 Nov 2012 by Jacques Loubser
HiHere are two converters. I use them & they work quite well.http://converter.telerik.com/[^]http://www.developerfusion.com/tools/convert/vb-to-csharp/[^]Jacques
18 Feb 2013 by gmaran23
Query the properties, or download a file present on a Unix server to a Windows server via SFTP connection
7 Jan 2014 by Maarten Kools
Yes[^]. Unless you mean something else by "rotate"?
8 May 2014 by Dave Kreskowiak
Pete's answer is probably better as you have greater flexibility in creating an installer than using InterDev.But, another option is to build an XP virtual machine (VMware has a "Player" version that's free) or Microsoft's VirutalPC, or VirtualBox, or any other) and just install your DEV...
1 May 2010 by Sandeep Mewara
They are not the only way, one od the ways to do them...VB6: Use Ascii values the way you want! Ex:Option Explicit'This will only accepts the alphabets and no other key is allowed.Private Sub Text1_KeyPress(KeyAscii As Integer) If Not KeyAscii >= 65 And KeyAscii
25 Dec 2010 by #realJSOP
If you can't write the code, hire a programmer to do it for you. The people here won't do it for you. That's not what the site is about. We *help* programmers who are having problems with code they're actually writing.
16 Mar 2011 by Аslam Iqbal
Charles henington, you can consider this as VB.NET.F5 is nothing but start debugging. You got my 5.Public Class Form1 Dim pastx, pasty, presentx, presenty, bt As Integer Sub moving() Dim xx, yy As Integer xx = presentx - pastx yy = presenty - pasty ...
31 May 2011 by Kim Togo
Check this link out Visual Basic .NET Programming for Beginners[^].All question you have asked is very basic questions and you do not give any code snip.And please read Code Project QuickAnswers FAQ[^], before posting questions.
25 Jun 2011 by OriginalGriff
No. It is:1) A lot easier with the source code.2) A waste of time - you will put so much effort into this that you would have been better off re-writing it from scratch.
27 Aug 2011 by #realJSOP
You can't run a Windows desktop application until the computer (and subsequently, Windows) has started, and a user has logged in. It's impossible. Period.
21 Oct 2011 by Simon Bang Terkildsen
Grab a white mouse,Tape it's front legs to the buttons of your PC-mouseAttach a camcorder to the head of the mouse.Call the white mouse vb6
28 Nov 2011 by lewax00
Iterate through the numbers, and keep track of the smallest one you've found so far. At the end, you'll have the smallest. I don't know VB6 but the method is fairly straight forward.
19 Dec 2011 by Wendelius
Is the error "Path not found" referring to your access database location. If that's the case, check that your program is referring to correct location and preferably define the location in a configuration file.Side-note: If this is a new program consider using VB.NET instead of VB6 which...
26 Jan 2012 by thatraja
Here you goVB 6 - Make P&D Wizard create Desktop shortcuts (Article)[^]
10 Feb 2012 by Christian Graus
I guess this is a legacy project ? I have no idea what registry keys are used ( I've never used VB6 and never will ), but, if a registry key is all you need, can you just add that key in your app and make it work that way ?
20 Feb 2012 by _iris_
Thank you for the guess :) - looks like it's something vb6-specific, for the target computer to understand the exe it has to be transferred per a complete setup, visual studio for vb6 supplies tools for that. now it works at the target computer.i'm not sure yet if other developers can use...
12 Mar 2012 by Richard MacCutchan
Nobody, is going to download some unknown file from a share site; nor are they going to write your code for you. You need to explain exactly what your problem is and what will not work.
11 May 2012 by Sandeep Mewara
Did you try to do this: Google search result of your title[^]Couple of similar discussion:How to store and retrieve images i...[^]How to store and retrieve images in sql se...[^]
7 Jul 2012 by OriginalGriff
If you aren't sure about something, use google and look for it on MSDN. In this case "MSDN str vb6" - it will generally put the important link at the top: http://msdn.microsoft.com/en-us/library/4y6a1sx7(v=vs.80).aspx[^]As it says, Str converts a number to a string.
11 Jul 2012 by Sandeep Mewara
It's ADO.NET with VB.NET/C# to read-write data.Read about ADO.NET here and it will help you:MSDN: ADO.NET[^]MSDN: Accessing Data with ADO.NET[^]CP archive:Using ADO.NET for beginners[^]Simple ADO.NET Database Read, Insert, Update and Delete using C#.[^]
16 Dec 2012 by Espen Harlinn
Have a look at: Face Detection in C#[^]SharpDevelop[^] can probably translate the code to VB for you.RegardsEspen Harlinn
18 Dec 2013 by Maciej Los
It's quite simple.Catch TextBox.Text value to string variable, then remove "%" and divide by 100 ;)Please see:Replace[^]Decimal.TryParse[^]
28 Jan 2014 by Sergey Alexandrovich Kryukov
The only reliable universal way of sending keystrokes to external application is using the low-level Windows API SendInput:http://msdn.microsoft.com/en-us/library/windows/desktop/ms646310%28v=vs.85%29.aspx[^].—SA
14 Feb 2014 by PopeDarren
Update Rules With Exception on Reply and Forward
11 Apr 2014 by Maciej Los
You did not provide enough information about your issue, especially about the reason of that behaviour. You did not provide your code too. Well, we can only guess...First of all, i'd suggest to read about Using early binding and late binding in Automation[^], Early and Late Binding (Visual...
5 May 2014 by Richard MacCutchan
If you are new then forget VB6, it was withdrawn years ago. Get yourself a copy of VB.NET (see http://www.visualstudio.com/en-us/downloads#d-2010-express[^]). As to how you would write an OCR application, you need to do some (or a lot of) research into the subject.
8 May 2014 by Pete O'Hanlon
Do you have a MSI file from the old machine? If you do, you can use the AdvancedInstaller repackager[^] to capture the changes that the VB6 installer makes, and create your new MSI from that.
9 May 2014 by Maciej Los
You need to loop through the collection of ListBox items.Open ... AS #1For i = 0 to ListBox1.ListCount -1 Print #1, ListBox1.List(i)Next iClose #1
7 May 2015 by Michael_Davies
You do not show code so difficult to help - what method are you using to connect to DB, ADODB? ODBC? OLEDB?.I'll presume it is ADODB - test the database-object.State.See https://msdn.microsoft.com/en-us/library/windows/desktop/ms675068%28v=vs.85%29.aspx[^]Example: If...
13 Mar 2019 by Member 12173401
Automatically clear/format the text box content with few lines of code. The idea sounds good, isn't it? It can be done with a foreach loop and form's control collection.
2 Jul 2016 by Six Hat Solutions
Easily Send Emails From Your Microsoft Applications Using VBA and the SendGrid API
9 Dec 2019 by KarstenK
Read this great article Calling C++ DLLs from VC++ and VB for details. Tip: create an own C++ dll with the same interface to test and verify your interface code.
12 Nov 2020 by FranciskaR
A new approach to fluid simulation
29 Apr 2021 by CHill60
Don't try to convert it would be my advice. Just write the VB.NET code that does the same thing. For starters don't try to use MSXML2.XMLHTTP.6.0. Use the built-in functionality with System.Xml (e.g. see xml - MSXML in VB.NET[^] ). That should...
8 Jul 2023 by OriginalGriff
The first thing to note is that you definitely shouldn't be saving your images in the app directory: in production machines that is under "Program Files" (or "Program Files (x86)") and those folders are write protected under modern OSes to reduce...
11 Feb 2011 by Bassam Abdul-Baki
Check the MSDN[^]. If you can't create a simple application, extending one will be problematic.[Edit: Moved link from comment]Writing Pluginbased Applications
1 Apr 2024 by Graeme_Grant
Okay, Google is your friend: 1. vb6 json - Google Search[^] - finds: https://stackoverflow.com/questions/2782076/is-there-a-json-parser-for-vb6-vba[^] 2. vb6 rest call - Google Search[^] finds:...
28 Jul 2000 by Len Holgate
Adding bookmark functionality is relatively easy and it enables our ADO recordset to be used with a greater number of data bound controls.
7 Nov 2001 by Migs
VB engine for the Sonork Instant Messenger
9 Jan 2010 by Dimitri Witkowski
Oh... please sorry, I've missed that you need a solution for VB6, not VB.NET. Here's example in VB: Function GetCpuID() Dim wmi, cpu, cpuid Set wmi = GetObject("winmgmts:") For Each cpu in wmi.InstancesOf("Win32_Processor") cpuid = cpuid + cpu.ProcessorID Next ...
13 Jan 2010 by thatraja
Hi,It's long time man worked in vb....I hope you are using MS-Access as backendcode is belowreport.DiscardSavedData = Truereport.Destination = crptToWindowreport.DataFiles(0) = App.Path & "\Inventory.mdb"report.ReportFileName = App.Path +...
23 Apr 2010 by Michel Godfroid
crtl-alt-del: cannot get rid of (short of writing a device driver).Others: quite complicated, and certainly not in VB6.What is it with you people, that you always want to write software that goes against the end-user wishes and annoys the hell out of everyone. When you come for advice on...
16 May 2010 by CPallini
Well, what is your trouble about? It looks like a simple task. :)
24 Nov 2010 by Goutam Patra
To print Barcode1. If you want to print through a barcode printer then you dont need to do anything. Just follow the your barcode printer's specification and print to a text file and print the text file using RAW printing.2. If you want to print it through a laser printer then you have to...
7 Jan 2011 by Dylan Morley
You can use the PlaySound API call to play an audio fileEdit: Updated linkhttp://www.a1vbcode.com/snippet-179.asp[^](if you google "PlaySound API VB6" you'll get lots of examples)
11 Feb 2011 by Abhinav S
This[^] might help.
11 Feb 2011 by Nish Nishant
If you want a 100% VB6 solution you'd have to use COM. Define the COM interface in one VB6 DLL, and then app references this DLL. Now any plugins you write will also be COM DLLs that implement this DLL. The app then loads these plugins via the COM interface. The plugins may need to be added to a...
12 Feb 2011 by Smitha Nishant
See http://msdn.microsoft.com/en-us/library/bb264566(v=sql.90).aspx[^]If you search (using Google/Bing) for "sql server 2005 vb6" you will get several results.
4 Apr 2011 by Wendelius
First, if you have a choice, don't use VB6 which is a legacy environment. So if possible shift to VB.NET.Secondly, Access is basically just a flat file so what you need is access to the file itself. You can map the share using both IP or UNC or use the file without mapping. Thirdly, you...
31 May 2011 by Sergey Alexandrovich Kryukov
Never leave unused variables in the code. Just remove them.Also, remember: if you collect warnings in your code, you will not be able to use warning mechanism at all. Develop warning-free!—SA
21 Jun 2011 by Prerak Patel
Try registering your OCX from SYSWOW64.Place your OCX in SYSWOW64 and use regsvr32 c:\Windows\SysWOW64\MSCHRT20.OCXThis would be helpful information to youhttp://msdn.microsoft.com/en-us/vbasic/ms788708.aspx[^]
25 Jun 2011 by CPallini
That's called reverse engineering[^] and, as already noted by OriginalGriff, it is usually more difficult than rewriting the code from scratch.
10 Jul 2011 by Sergey Alexandrovich Kryukov
Short and best answer: get rid of VB and try to forget it as soon as you can. VB6 controls don't support Unicode. And don't even play with the idea of supporting Russian through any of the legacy encoding. It's better not to support Russian at all.Long and ugly way: it looks like there is a...
2 Aug 2011 by ARopo
I have a win32 application that loads .net assemblies into a window allowing the user to us it and then close it when they finish.Problem is my application goes from about 50mb to 200mb when the user opens the .net part and stays there even after the user has closed the hosting window.I...
28 Jul 2011 by BobJanova
You need to use AppDomains, and load the DLL in question into the other app domain. You also (obvious in principle but can be hard to remember) need to drop all references to objects in the other assembly to get rid of it. This carries with it other problems like you need to marshal things...
20 Oct 2011 by André Kraak
You did not specify which platform you want to use to send the mail.Have a look at this vbSendMail.dll Version 3.65-- Easy E-mail Sending in VB, with Attachments[^]
21 Oct 2011 by Orcun Iyigun
This link is the answer to you problem. It is explaining giving permissions to folders instead of files. So what you should do is; to change DirectorySecurity to FileSecurity will solve your issue.Here is the link;http://63.236.73.220/showthread.php?t=616021[^]Good luck.
26 Oct 2011 by Abhinav S
First, the term "static object" is a misnomer. A static class cannot be instantiated in .Net.You can expose a static method or class in .Net.Instead of CreateObject you can use the new keyword and that will create an instance of a class for you.In case you don't want to do all this,...
19 Dec 2011 by thatraja
I think you got this error Path not found (Error 76)[^]I think you have used hard-code path(Ex. F:\Database\db.mdb). If your target machine doesn't contain the F drive then it'll show the above error message.My suggestion is use App.Path[^]So your connection-string will be like as...
25 Dec 2011 by Dalek Dave
VB6?Dial up?Would you not be better off sending a telegram?If Not, Try Here.[^]
29 Dec 2011 by Furqan Sehgal
Hi,My problem is I have to install VB6 on client's computers if I want to run my VB6 applications. Actually the version of VB6 I have, can not make setup file. So I just make a link to the exe file manually. Is there any way that I donot have to install VB6, could just copy a few files...
26 Jan 2012 by Abhinav S
Have a look at step 11 in this article[^].This[^] could help you as well.
29 Jan 2012 by thatraja
Not supported[^]. Go with .NET here you go for Visual Studio Express Editions[^]For code conversion, check this blog post.NET Code Conversion[^]
29 Jan 2012 by thatraja
Check this Tip/TrickOpening the Internet Browser Programmatically[^]
23 Mar 2012 by OriginalGriff
Depends on the power supply that you want to turn on and off.If it is the PSU for the PC you are running on, you can't. How do you expect to run software to turn on the power supply, when the power supply must be on for the software to run?If it is an external power supply connected to...
8 Apr 2012 by OriginalGriff
There is a very good chance that this won't work: I have yet to meet a flash drive with a serial number, but maybe that's because I buy cheap ones...Add a reference to System.Management, then:Dim all As New ManagementObjectSearcher("SELECT * FROM Win32_DiskDrive WHERE...
11 May 2012 by Wendelius
You didn't mention the database you're using, but let's say it's SQL Server. Regardless of that, if you want to maintain the integrity of the data in the database, don't check the relations in your code. Use the features of the database instead. So if this is for example SQL Server, see SQL...
12 May 2012 by OriginalGriff
Assuming that you set sortonname as a VB variable, pass it though to Access as a parameter (@SortOnName below) and try this:IF @SortOnName=0 SELECT * FROM students ORDER BY cityELSE SELECT * FROM students ORDER BY name
19 May 2012 by OriginalGriff
Look at doing a bulk insert via SqlBulkCopy[^]Here is one way to do it, inserting a whole DataTable:Dim strConnect As String = "Data Source=GRIFFPC\SQLEXPRESS;Initial Catalog=Testing;Integrated Security=True"Using con As New SqlConnection(strConnect) con.Open() Using bulk As New...
25 May 2012 by Sandeep Mewara
Sounds like you want to do Image cropping. Look here:Video: Visual basic crop image tutorial - YouTube[^]Crop a picture and save the result in Visual Basic 6[^]
4 Jun 2012 by thatraja
Use parameters because read the below oneDatabase - Why should I use Parameters instead of putting values into my SQL string?[^]
11 Jun 2012 by Jαved
Hi, here is your code- shell "C:\Program Files\Internet Explorer\IEXPLORE.EXE http://www.google.com"
25 Jun 2012 by Richard MacCutchan
Member 7793959 wrote:Its an application which uses some OCXs and DLLs from Microsoft OfficeSo the app requires MS Office to be installed.Member 7793959 wrote: I can't afford to ask each of my clients to install Ms Office along with my software.How else are they going to get the prerequisites?
12 Aug 2012 by Richard MacCutchan
Simply pasting your question into Google gets you these suggestions[^]. Unless you learn to do your own research you are going to have some major problems as a developer.
22 Aug 2012 by Wendelius
In my opinion, no valid reasons exist. The sole purpose of null value is to describe that the is no data or the data is unknown.I could imagine that this has been reasoned because of the indexing, foreign key and constraint related 'issues' but those things can quite easily be tackled with...
22 Aug 2012 by Sergey Alexandrovich Kryukov
A person who uses something like -5000 as a special magic value to conduct "not a value" is a complete idiot and moron. Actually, using VB6 does not have any excuses. The only reason to use it I can see is to sabotage.Here is one of the most difficult issue of your profession: one of your...
27 Aug 2012 by D-Kishore
Hi Dear,Here i am giving the code in c#. It will be helpfull for you.private void Form3_Load(object sender, EventArgs e) { var strid = "SEA0000998"; var intPos = strid.Length; var stringChars = new string[4]; var intSummand =...
27 Aug 2012 by Prasad_Kulkarni
Refer:Auto generate a alphanumeric uniquekey[^][EDIT]Automatic Increment alpha numeric[^]Auto increment number with alpha numeric[^]alphanumeric autonumber[^]Automatic Increment alpha numeric[^]