Visual Basic 6 Code Sample

  • FreeVbCode.Com is a code repository for free Visual Basic code and samples. Visual Basic examples and articles are freely available to download and review.
  • Where are the NI-DAQmx examples for Visual Basic 6.0 located? Looking through the examples that installed with NI-DAQmx, I noticed that there are numerous examples written for C, but a very limited number of examples available for Visual Basic 6.0.
  • Podcast #45 – Keeping it Sharp

    PodcastOur guest this week is Eric Lippert – language architect extraordinaire and famous for all his work at Microsoft in developing their languages Eric joined Microsoft right out of college and was origin

    7 years ago

  • An Internal Application Message Bus in VB.Net

    ArticleWorking with threads gets complicated quickly as you work to stop them falling over each other. One way to organise threads so that they co-operate without tripping over each other is to use a messagi

    8 years ago by John Rivett-Carnac

  • Launch of Visual Studio LightSwitch 2011 with Beth Massi

    PodcastCodeCast Episode 109: Launch of Visual Studio LightSwitch 2011 with Beth MassiIn this episode of CodeCast, Ken Levy talks with Beth Massi, a senior program manager at Microsoft on the BizApps team who

    9 years ago

  • Learn F# Programming

    ArticleProviding both leading-edge functional programming and familiar object-oriented capabilities, F# gives the developer more power to solve problems -- all in fewer lines of code, thanks to succinct synt

    9 years ago by Ted Neward and Jessica Kerr

  • Official Kinect SDK finally available

    NewsIntegrate Kinect with your desktop applications

    9 years ago by Chris Alexander

  • Visual Studio LightSwitch with Beth Massi

    PodcastCodeCast Episode 104: Visual Studio LightSwitch with Beth MassiIn this episode of CodeCast, Ken Levy interviews Beth Massi, a senior program manager at Microsoft on the BizApps team who build the Visu

    9 years ago

  • Microsoft ADO.NET 4 Step by Step (Step By Step (Microsoft)

    BookTeach yourself how to use ADO.NET 4, the data access technology that helps you create effect on your forms.

    15 years ago by Adil Hussain Raza

  • Messenger Client Coding

    CodeI hereby submit Messenger client side Coding . This is very useful for Beginners who are going to develop Messenger in VB. In this coding also i was using WinSock control.

    15 years ago by Hari K

  • Number Systems

    ArticleMost programmers are aware of a few number systems. Decimal, Binary, Octal, etc. VB.NET allows you to work with these number systems, but these alone.

    15 years ago by Mitch ★

  • Show/Hide Desktop Icons

    CodeThis code uses API calls to Hide/Unhide icons on the desktop. This code uses FindWindowEx & ShowWindow API Calls to do the job.

    15 years ago by Adil Hussain Raza

  • Large Number Operations

    CodeWhat do you do when you want to work with numbers that have a total length of digits that reach into the billions?

    15 years ago by Eric

Windows task snippets. Snippets of ready-to-use code that accomplish small, but useful, tasks of interest to UWP app developers. These snippets show simple solutions to common problems, and simple recipes to help you implement new app features.

Stay up to date

Jobs

ExamplesVisual basic 6 sample codePdf
  • Software Developer - Top Secret cleared - Washington, DC

    MorganFranklin in Washington, DC, United States

  • Senior Software Engineer

    ABX Express (M) Sdn Bhd in Petaling Jaya, Malaysia
    $18,000-20,000 USD per year

Discussion

  • System Error &H8007007E. The specifed module could not be found.

    2 months ago by swiftsafe (5 replies)

  • How to disable text box

    8 months ago by ansulrana8501 (4 replies)

  • Printing on label printer

    1 year ago by fernandopeter477 (11 replies)

  • Remove OCX from the Component List

    1 year ago by franklinjones199333 (4 replies)

  • asm -> hex

    1 year ago by aronwarner11 (7 replies)

  • can anyone help me out

    1 year ago by digisoft (2 replies)

  • VB MultiPage Focus problem

    1 year ago by Erwin10452 (6 replies)

  • XArrayDB

    1 year ago by macmac (3 replies)

  • DOT Matrix Printing from VB 6

    1 year ago by lj962500 (32 replies)

  • Make setup vb6 + sql 2000

    2 years ago by ibelivethereishope (2 replies)

Visual Basic 6 Code Samples

This demonstrates displaying some message boxes using the MsgBox function. Add three command buttons called cmdExample1, cmdExample2 and cmdExample3. Add the code below, and then run your project

Visual Basic 6 Sample Code

Option Explicit
Private Sub cmdExample1_Click()
Start:
Dim Msg As String
Dim Icon As Integer
Dim Title As String
Dim Buttons As Integer
Dim Ans As VbMsgBoxResult
' Fill Message string
Msg = 'Select Abort to Cancel, Retry to try again and Ignore to ignore this problem' & Chr(vbKeyReturn)
Msg = Msg & 'This is the second line' & Chr(vbKeyReturn)
Msg = Msg & 'You can do this by using Char code 13'
' Set dialog Title
Title = 'Msgbox Example - Abort Retry Ignore'
' Set icon to critical (X)
Icon = vbCritical
' Set buttons to abort, retry and ingnore
Buttons = vbAbortRetryIgnore
Buttons = Buttons + vbDefaultButton2 'set default button to retry
Ans = MsgBox(Msg, Buttons + Icon, Title)
'alternatively, simply
'Ans = MsgBox(Msg, vbAbortRetryIgnore + vbDefaultButton2 + vbCritical, 'Msgbox Example - Abort Retry Ignore')
' If the user clicked Retry, try again
If Ans = vbRetry Then
GoTo Start
' If the user clicked abort exit procedure
ElseIf Ans = vbAbort Then
Exit Sub
End If
End Sub
Private Sub cmdExample2_Click()
Dim Msg As String
Dim Ans As VbMsgBoxResult
' Fill Message string
Msg = 'This may take a while. Click OK to continue' & Chr(vbKeyReturn)
Msg = Msg & 'If you click Cancel, to abort'
' Set icon to information (question mark)
' Set buttons to OK and Cancel
' Show Message Box
Ans = MsgBox(Msg, vbOKCancel + vbInformation, 'Msgbox Example - OK Cancel')
' If the user clicked cancel...
If Ans = vbCancel Then
MsgBox 'Cancelled'
Exit Sub
End If
End Sub
Private Sub cmdExample3_Click()
Dim Ans As VbMsgBoxResult
' Set icon to exclamation mark
' Set buttons to OK and Cancel
' Show Message Box
Ans = MsgBox('Are you sure you want to continue?', vbYesNo + vbExclamation, 'Msgbox Example - Yes No')
' If the user clicked no exit sub
If Ans = vbNo Then
Exit Sub
End If
End Sub