Controls Guide

Level:
Level2

This Visual Basic 6 guide takes you step by step through tutorials on this site that will show you how to use all the main VB6 controls. The best way to navigate through the guide is by using the links on the left. Or you can use the links below and then hit your browser's back button. Each link will take you to a different tutorial on this site that will teach you the next step you need to know to learn.

Here are some optional exercises you can try yourself or simply download them and look at the source code. They all use things listed above.

Comments

open word document, find string and highlight it through vb prog

i want to write a programme which doed follow things
1) from vb form directly open word document
2) find the specified string on that document
3) highlight string on docum,ent
can some body helps me
i write code like this

Private Sub lblVisitReport_Click()
Dim objword As Word.Application
Set objword = New Word.Application
objword.Visible = True
objword.Documents.Open (gReportpath)

findText = txtSchemeDes.Caption

If objword.selection.Find.Execute(findText) = True Then
MsgBox "text found", vbCritical + vbOKOnly, sTitle
Else
MsgBox "text Not found", vbCritical + vbOKOnly, sTitle
End If

End Sub

by running it opens vb document but could not find sting and highlight
pls help
thanks in advance

open many forms in same project

whenever i save a project (it is saved ) but when m trying to open the project all the forms are splitted apart and all opens in different vb application can u help me out :
1) i want to open all the form in the same vb project window(not splitted apart which opens in different vb application).
2) In ADODC connection is it necessary to connect with (MS access or sql server) each time we start the project ?

Manipulating Notepad once open, using Shell or ShellExecute.

How to ShellExecute (API call) Notepad (or a like program) and manipulate it by navigating to the bottom of existing data, subsequently entering a Date/Time Stamp, as in a .LOG entry format.

And alternately, the same with a Text Box control.

Thx

Tutorial on MshFlexGrid

Dear Sir,

Your tutorials are very understandable and good so can you please write tutorial on using MshFlexGrid.
Thanks,

Uday Kumbhar

pls i need help!!!

please, can someone help me out with d vb codes required to minimize any form of Boolean expression. 10ks

calling other windows program...

how can i call and access calculator, calendar or other windows program using vb? i really need help..

call another window programe from vb

use the shell function for execute the any exe file in windows

Serial coding (Transreceiver)

I need help in coding a serial communication in vb 6 . Please help its urgent. how can i send an receive an array of bytes and than transmit it.

need help with vb studio 2005

I need help in connecting vb studio 2005 with Ms access 2000.............thank you in advance

Pls help me

how to connect vb6 to ms access or mysql using adodb, and a sample code of user login using database ms access..........plssss help mee thanks a lot!... -josh--

its juliana@gmail.com

its juliana@gmail.com

simple programme

want to create a simple programme that keeps infromation entered daily, can somebody help via the email

tab keypress

what is the code of this...using the tab if i press it the focus transfer to the next textbox..pls help me

sendkeys"{tab}"

sendkeys"{tab}"

keypress for numbers?

can you pls tell me that how to restrict a text box that enters only numbers 0-9

On Error Resume Next If

On Error Resume Next
If KeyAscii < Asc(0) Or KeyAscii > Asc(9) Then
If KeyAscii = 8 Then
Exit Sub
End If
KeyAscii = 0
End If

How do i make a process box

How do i make a process box. I really need to no!!!

How do I return cursor location (Line, Col.) in a Rich Text Box

How can I return the cursor location (Line,Col.#) in a Multiline Rich Text Box?
Is there a better way than using SelLength? or the SelChange Event? or
Where can I get a complete tutorial on Rich Text Box? Im talking beginer to adv.
The works. I want to creat a text editer in a MDIform and I soooo need help.

Thanks for any help I can get.

can u help on how to access

can u help on how to access database from the ms excel???plssss....thanks

I/O

Hi, since everyone is asking everything i'm going to ask too :)

I have been wondering How to find modules and drivers to program input/output on PCI bus. And if there is any way to see a sample code of using these two in typing a program to send/recieve data through PCI on motherboard.

So far I have used inpout.dll with inpoutv4.bas and port.dll with ports.bas and I've used it to make a program to control LPT for use with a 2X16 lcd display.
Now I want to use a PCI or atleast ISA to control a memory chip with 16 adress ports because LPT is limited with 8 (max 12) output pins.

I have been doing this with everything that I have at home, so I don't want to buy software or hardware wich is too expencive for my standards.

I have everything set and waiting for the drivers and modules and I am wery gratefull for any kind of info on how to do this.

BTW if anyone has any questions about making small and usefull aplications in VB send questions to alesacar@yahoo.com, I don't promise but may be of help.

Help me!!!!

A textbox is on a form. User will type his/her name in that textbox. But ny problem is when user type the text in which the first alphabet of the text which he/she shall type , the first alphabet will be automatically capital.How can I do it?????????????????

upper case first charcter in text box

just type following code on textbox lostfocust event for want u result..

Private Sub txte_LostFocus(Index As Integer)
If Index = 3 Then
txte(3).Text = UCase(Left(txte(3).Text, 1)) + LCase(Mid(txte(3).Text, 2, Len(txte(3).Text)))
End If
End Sub

Propercase

Private Sub txtFname_Change()
txtFname.SelStart = Len(txtFname) + 1
txtFname = StrConv(txtFname, vbProperCase)
End Sub

This is an easy one......

This is an easy one...... try this code

Private Sub Text1_KeyPress(KeyAscii As Integer)
If Len(Text1.Text) = 0 Then
KeyAscii = Asc(UCase(Chr(KeyAscii)))
End If
End Sub

About ADODB

How can I connect VB6 project with Microsoft Access by ADODB? PLZ... Help me soon...

connecting vb6 with ms-access via adodb

there are lots of options to connect vb6 apps to an ms-access dbase via adodb. here is a sample procedure to do it.
activate the adodc tool at the toolbox. right click toolbox and click components. then at the control tab choose ado data control 6,afterwards click apply button and then the ok button.

now put adodc tool at the form, and right click it. and at the drop list option choose adodc properties. then choose "use connection string" option and click build button. afterwards choose dbase engine to be use and set the dbase source file. then test the said connection. else if not success check the engine youre using. and also the soure dbase.
now create a connection module.

check this sample connection module ---------- >>>
Option Explicit

Public rs As ADODB.Recordset
Public con As ADODB.Connection
Dim c

Public Sub db()
Set rs = New ADODB.Recordset
Set con = New ADODB.Connection
c = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\dbase\posbase.mdb;Mode=ReadWrite;Persist Security Info=False"
con.ConnectionString = c
con.Open
End Sub

and your main app you can now use the db object and its rs, con functions..
use SQL statement to open a connection"
.....enjoy

need to open multiple autocad drawings

Dear All,
I have a 20 autocad drawing files in a folder.
I have the list of the drawing with its path name and file name in the excel sheet.
I need to create a vb program so that it opens all the 20 drawings in autocad application one by one and give print and close the drawings.
please provide me a simple program for that, becasue i am not well versed in VB programming... Thanks in advance.

Restrict a textbox to enter alphabets only

pls tell me that how to restrict a text box to enter only alphabets like A-z, or a-z

to resticate alpabets certain text box

Private Sub Text1_KeyPress(KeyAscii As Integer)
Dim i, j As Integer ' their is many other ways i find this better

For i = 65 To 90 ' 65 to 90 is Ascii value of captial "A" to "Z"
If KeyAscii = i Then
KeyAscii = 0 ' make ascii value null
End If
Next i ' do it for next number

For j = 97 To 122 ' 97 to 122 is ascii value of small "a" to "z"
If KeyAscii = j Then
KeyAscii = 0 ' make ascii value null
End If
Next j 'for other info contact electrorony@gmail.com

End Sub ' thanks to u RONY CHAKRABORTY

In the keypress event for

In the keypress event for the textbox, add the following code:

    If (KeyAscii >= 65 And KeyAscii <= 90) Or (KeyAscii >= 97 And KeyAscii <= 122) Then ' 65-90 = A-Z, 97-122 = a-z
        Exit Sub
    ElseIf KeyAscii = 8 Then ' allow backspace
        Exit Sub
    ElseIf KeyAscii = 13 Then ' allow "enter" key
        Exit Sub
    Else ' kill everything else
        KeyAscii = 0
    End If

Hope That Helps!

Chewdoggie

How to to create multiple forms in run time

Can anyone please help me How to to create multiple forms in run time

HOW TO ACCESS DATABASE IN MS EXCEL

CAN ANYONE TELL ME? I AM REALLY IN NEED

Thank you very much between

Thank you very much between here and vbasic.net i will be able to complete my projects!!! you rock!!

VB

thankx Lot Dear Sir I got more from your page. Few codes did lot.

Thank you very much!

it help me a lot, ... :-)

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.
  • You may post block code using <blockcode [type="language"]>...</blockcode> tags. You may also post inline code using <code [type="language"]>...</code> tags.

More information about formatting options