Visual Basic Guided Tour
How Do I in Visual Basic Express

How Do I is your introduction to important task-based topics about Visual Basic programming and application development. The major categories of what you can do with Visual Basic are listed in this topic. The links lead you to important procedure-based Help pages.

Upgrade for Visual Basic 6.0 Users (How Do I in Visual Basic Express)

Upgrade a Visual Basic 6.0 Application … Learn the .NET Framework … more

Learn the Visual Basic Language (How Do I in Visual Basic Express)

Object-oriented Programming … Manage Control Flow … Work with Variables … Handle Errors and Exceptions … more

Windows-Based Applications (How Do I in Visual Basic Express)

Forms and Controls … Data … Printing … more

LINQ (How Do I in Visual Basic Express)

Language-Integrated Query ... LINQ to Objects ... LINQ to SQL ... LINQ to XML ... LINQ to DataSet ... more

Data Access (How Do I in Visual Basic Express)

Getting Started … Load Data … Validate Data … more

Deployment (How Do I in Visual Basic Express)

Deploy with ClickOnce … Create a CD for My Program … Send a Program through E-mail … more

Security (How Do I in Visual Basic Express)

Web Applications … Windows-based Applications …Components … more

Debug and Test (How Do I in Visual Basic Express)

Debug Applications … Monitor Applications … more



Community Content

RobXD
How do I save a picture on a web page using code?
how do i make something that when i click a button a progress bar pops up and starts loading help please!

How do I use RGB(red,green,blue) fujnction in Visual basic 2008?base on

ask a specific question, not something that general

amaredabi
How do I?

How do I set a textbox to a number value such as an Integer?


There are several ways of going about this... The most basic way is to do a simple conversion, ike so:

Cint(textbox1.text)


This code is just used anywhere you would usually place

Textbox1.text



Rob =]

Tags :

RobXD
KeyPress (Enter)
I would like to find out how to use the Keypress event for the button enter on the keybord to us the code


WebBrowser1.Navigate(NavBox.Text)


This one is not hard, all you have to do is use the KeyDown event instead... for example

Private Sub Form1_KeyDown(ByVal e As System.Windows.Forms.KeyEventArgs)Handles Me.KeyDown

If e.keyvalue = keys.enter then

WebBrowser1.navigate(NavBox.text)
End if



Have Fun!

Rob =]




Tags :

Doogledude123
how do I delete old projects and project titles?
delete old projects?

Simple... open the folder its in select the folder right click on it delete! done
Tags :

hackprofessor
How Do I???
Hey Guys i was wondering How to open a dialogbox then select files then press ok then it will add it to the ListBox... or somthing along that line...

Try using the premade Save or Save As dialog boxes (they're at the bottom of the toolbox)
~HackProfessor


ry2004
Screen Shot
How do I take a photo of the application for study purposes?

Start the program then click Print screen (PrtSc) on you keyboard then open paint
and paste it with control+v (Ctrl+V) on the keyboard.
Anwser By: Ry2004
Tags :

mr_whiz_kid
search
hi there... i'm wondering how can i seach an existing data in a database like employee id and shows all of its information.
kindly answer me. your reply is very appreciated. thank you.
Tags :

mr_whiz_kid
print
how can i print the data from database?
Tags :

ry2004
HELP!!!!!!!!!!!!!!!
How do i make it so when i click a button that another form thing comes up????

Ok this is very simple say you whanted to open form2 when you click the button you would type:
Form2.Show ()
Just replace Form2 with the form you whant to open.
Anwser By: Ry2004
Tags : for next ..

Antileech
For loop
I 've tried this but did not work

for i = 1 to 20 step 2

print i , i^2

next i

but there was a problem with "print" command , how can i display the values for i and i^2 ?
thnx


If you're aiming to display the outcome to the user rather than print it (to a printer), i'd recommend creating a list box called LstResults (Or whatever you wish, making sure you change the code accordingly) and using this code:

for i = 1 to 20 step 2

LstResults.items.add(i & " = " i^2) 'Adds a new row to the listbox containing the value of i, an equals sign and then the value of i squared

next i


Hope this helps.

Answer by Antileech

Tags :

WalidJ
How do i plot y = x^2 in VB.net ?
plz provide me with the code to plot the gragh of y=x^2 or any function, thnx
Tags :

RAllan
How do I save variable length strings in a text file?
I have multiple string arrays that I would like to save in a text file to access them later using the standard File dialog open and close functions. Can you provide me with an example of how to do that?
Tags :

RobXD
Virtual Basic Express 2008

HELP!!!! HELP!!! HELP !!!! How do I code the + , - and * buttons for a calculator? How do I code the text boxes for the numbers/text box,.. and for the 'sum' text box so it's cleared every time you put a diff. number in to add an subtract? Do you take out all the exisiting code that's between the Private Sub and the "end" ????? or do you leave in the existing code and add to it whatever's supposed to be IN there,.. and what IS supposed to be in there ?! our text book is NO HELP and Microsoft's help is NO HELP!!!! UUUUGGGGGH!!!!!

First of all, when you deal with textboxes and +/- you need to make them into integers, which is done by replacing TextboxAnswer.text or ButtonOne.text in your code with Cint(TextboxAnswer.text) etc.

Also, you need to place the following code in the event for the Equal button press

TextboxAnwer.text = ""



that clears it.

If you want, just before that line, you could include a variable to make the original sum hang around:

Public answer as integer = 0

Private Sub Equals_pressed(byval e as system.eventargs)Handles Equals.pressed
Answer = CInt(TextboxAnswer.text)
TextboxAnswer.text = ""
End Sub
Tags : code

RobXD
C++
can I use this program as a C++ compiler?

Wtf... no of course not. Its VB.net

If you want that functionality, download Visual C++
Tags :

hackprofessor
End statement?

Yes it may sound sad but how do i fix the "end statment expected" error?

Try defining your variable value within the line such as:

Dim VariableName As Integer = TextBox1.Text
Tags :

Jonathans1987
Changing Forms
How do I make a button on form1, open up form2? In other words I want to have a button on my first form, that opens up an entirely different form that is in my current project folder. Nevermind found the answer :]
Tags : forms changing

VeeBeer
How DO I???

I have a form with a disabled button and a normal text box. I want to make it so when the text box says something the button becomes enabled. For example if the text box says password then the button would become enabled

Define your password first

Public Password as string = "Password"



Then in the TextChanged event for the TextBox

Private Sub TextBox_TextChanged(ByVal e as system.eventargs) handles textbox1.textchanged
If textbox1.text = "Password" then
Button1.enabled = true
else
button1.enabled = false
end if





Rob =]

Tags :

VeeBeer
Stop code with another event

Simple form with 2 buttons
First button starts code running (say updating the value in a text box)
Second button stops the code
Problem I have is that form has lost focus so how do I effectively allow other things to happen while code runs - it's not multi-threading is is?
Thinking about it I could have a seperate process in another app to change a value which the running code tests for but that's very cumbersome!

Heres a basic Layout to do this:

Ingredients:
2 Buttons (1 Says Start Other Says Stop)
1 Textbox or NumericUpDown
1 Timer

Code:
Timer 1:


PrivateSub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick 
NumericUpDown1.Value = NumericUpDown1.Value + 1
Textbox.Text = TextBox1.Text + Val(1)
EndSub


Start Button:

  

PrivateSub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Timer1.Enabled = True

EndSub


Stop Button:

PrivateSub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Timer1.Enabled = False
EndSub


Very Simple

VeeBeer

Tags :

Antileech
This is hard!?#
how do i get a spell check in my project

Make one.

I agree with whoever edited above, the only way to spell check text entered is to create something yourself or be a script kiddy and google it.
You'd need a text file or database containing every word recognised by the dictionary of whatever language you're using (English, Spanish etc.) and then set it to check the text entered for anything that doesn't match a word in the text file/database of words.


Tags : check spell

Antileech
Help with microsoft works database input and output
I need to know how to use make a database with personal details collected from the user and then be able to access this database through the program if possible I would prefer to use microsoft works for my database

I am greatfull for any help thanks

This would be too hard to understand if it were explained here
Find a teacher who knows about it and ask them to show you in person.
Tags :

VeeBeer
DrawPolygon etc ?
How do I Draw and Fill a polygon and other shapes of my own?

Go into your toolbar and click on the Visual Basic PowerPacks Group
Tags : shapes

Antileech
create a calculate total button
i have a access database attatched to my project and i have a combobox which you select the machine type from then the
-basic price
-manual boom price
-battery price
-LMI price
are all displayed as labels that change when you select a different model from the combo box.

i need the code to calculate the total of the values in the labels.

Thanks


Create variables for each separate price factor (Basic Price, Manual Boom Price, Battery Price, LMI Price and any others) also one called Total. Set them all to data type Integer (Example: Dim BasicPrice as Integer)
Then set the variables to equal their respective labels (Example: BasicPrice = Val(LblBasicPrice.text)
Finally add them all together
Total = Price1 + Price2 + Price3 + Price4 etc. etc.
Tags :

Antileech
How we handle the Date type of data?
Is there an explanation that will tell me how to procedure a date and time created in one datatype? In Visual Basic 6.0 there used to be the CDATE=date$+time$

The function Now() retrieves the current date and time according to your system, for example
LblDate.text = Now()
Would display 23/11/2009 21:43:00

DateString() retrieves the date according to your system
TimeString() retrieves the time according to your system


Answered by Antileech

Tags : date

Dusky666
how do i make the textbox automatically blank the next time user uses it?
i filled in the textboxes and insert data.
but the second time i want to insert, the old data is still there.
how to make it blank?? automatically

if the user clicks the textbox
simply code this under the textbox_click even: textbox.text = ""

if the user uses tab to select it or if automatically directed
use the textbox_enter event and clear the text
Tags :

Dusky666
How do i get the textbox to display the math problem and answer?
I had to make a calculator the has a add button a subtract button and a multiply button. there is a txtbox for the first number and one for te second numer. then there is a read only txtbox that displays the result of the problem. I need this txtbox to show the problem performed and the result. My book does not show me the code for this, and I have searched all over the web and can not find it. 2 weeks behind on this project. Someone help me please..................


are the only numbers involved in the calculation entered in the 2 textboxes?

if so then

readonlytextbox.text = firstnumber.text & _
" " & calculation (X, /, -, +) & _
" " & secondnumber.text & " = " & answer

obviously replace all the names ive used with the ones used in your code
Tags :

VeeBeer
Need some help:-)
Hi, i need some help to write a program that accepts a word as input and determines if its letters are in alphabetical order:-) know how to do it with several words but not with the letters themselves :<

Its accually quite easy!

Put this code into a textbox:

Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles
TextBox1.TextChanged

If TextBox1.Text = "InputText" Then

Button1.Text = "InputText"
Button1.Enable = True
Button2.Text = ""
Button2.Enabled = False
Elseif TextBox1.Text = "InputText" Then
Button1.Text = ""
Button1.Enabled = False
Button2.Text = "InputText"
Button2.Enabled = True
End If
End Sub


Tags : omgneedhelp

Seljehaug_89
Need some help:-)
Hi, I need some help how to write a code that determines if its input letters are in alphabetical order:-)

Antileech
HELP PLZ
How do i make it so that, when i click a button it makes a label visible but after that then making it possible of using the same button to make the label invisible and, also once you have clicked the button to make the label visible how do you make it change the buttons name automatically so that it suites the button to make the label invisible


Put the following code into the Button click subroutine
You'll need to change the button name from Button1 to whatever yours is called, the same for Label1

If Label1.visible = True then
Button1.text = "Show Label"
Label1.visible = False
Else
Button1.text = "Hide Label"
Label1.visible = True
End If

Tags : help button label

ks0151
Need help with focus on three textboxes.

my assignment is to create three textboxes and within each put text one for txtbox 1, two for txtbox2, and 3 for txtbox3. then code them so that when i click one , two , or three it focuses on it with a red forecolor. How do i go about coding them so that can happen? help pls.

Tags :

Dalqin
Defining different outcomes for each combobox item.
I'm interested in having a different message box show for each selected item in a combo box I have added and listed items within. I am able to get one message box to show for any item I select, and I am able to have a message box show when no items are selected. I can't manage to get VB to show different message boxes for different selected items on a button click. Any help would be greately appreciate, I've been dinking with this for about an hour and a half now :p

Nasadaws
Progress Bar
Hello!

I am trying to make a web browser; how do I make the progress bar "do something" when a page is loading?

Thanks!

You use the Load. It's found by double clicking on the form
Here is the default code.

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

End Sub

-RLR
Tags : progress bar

SPARXXZ
HELP HELP HELP HELP HELP HELP HELP
UM HI, I REALLY NEED SOME HELP, HOW CAN I GWT MY PROGRAM TO EXIT WHEN I PRESS THE BUTTON EXIT IN THE MENUSTRIP, AS LONG AS SAVE, PRINT, NEW, AND OPEN? ALSO HOW CAN I LINK UP MY FORMS SO IF I SAY OPEN, HOW CAN I GET IT TO OPEN A EXPLORER???

THANX
Tags :

Antileech
Add Items in a ListBox
I need to be able to add the items together in a list box. Not the selected ones, but everything. I don;t want to addd the number of items, I want to add all of the values in a list box.

For instance, if I have 100, 200, and 300 in a list box, I want to be able to add them and display that number somewhere, ie. a label.

Note: I will not know the number of items in the list box, so there could be ANY number of them in there.


Use a For loop:

Dim Total as Integer
For i = 1 to ListBox1.items.count 'ListBox1.items.count counts how many items are in the listbox
ListBox1.SelectedItem = i 'Selects item at value i
Total = Total + ListBox1.SelectedItem()
Next i

There might be an easier way, but that's all i could think of.

Answered by Antileech

Psycho Sweeney Todd
if anyone can help thanks
wat is the code for square root.... i tried Sqr but it isn't recognising it

x = number
x^(1/2)
power of ahalf = suare rooting
Tags : x your = number

zx7
How can I remove projects from visual basic 2008 express edition
How can I remove projects from visual basic 2008 express edition, I have tried selecting the project in solution explorer and then clicking the edit tab as suggested in the help section but there isn't an option to remove or delete or cut. What can I do to get rid of test projects that I no longer need.
Tags :

fatherromo
How Can i get The box value to save
i want to log the typed value in a text box into not pad but dont know how ?
Tags :

LEGATT0
HOW do i compute for the elapsed time?

may start time ,end time and elapsed time must be in "hh:mm:ss" format

Tags :

JR15
Background changes

How can i change my background (of my form) in runtime by pressing a button??
Used an Image as background that is.

Grtz & Thx

Tags :

Viva_Sebastian
@___@ Thread State / Web Browser
Simple splash screen which ends with this code:

Me.Hide()
Form1.Show()


And it works perfectly, right? Butttt when I add a webbrowser to Form1, I can't get out of splash screen. I get an error for ActiveX because it "cannot be instantiated because the current thread is not in a single-threaded apartment."

How do I set ThreadState? Do I need it in both forms? Where exactly in the code do I type and what??

Mindrage
New to Classes.
I usually script things in Visual Basic 6.0, but when i updated to Visual Basic 2008 Express i got a shock when i saw the "Class" Lines.

Im new to programming but i certainly dont know what Classes do.

What i've understod from the tutorials, it was a Group of Values and Actions?
I really dont understand it and its blocking me a bit to code in VB-08.

Anyways to show an Example Class Sub and describe what the things in it does?
Tags :

james.mackie
lastIndexof method

how do i use the lastIndexOf method. i want to remove just the file name from the filepath could someone please Help?

Tags :

Antileech
How do i..
Hey guys

Might be the most stupid question you guys have ever heard..

How do i save a file,and then open the program without having to reopen Visual Basic?
When i click on the file,it just doesn't activate it,might be a problem in my computer aswell,just being sure.

Thanks already!

Click on Build in the toolbar (Top of the VB screen)
Click on Publish ProjectName
This will compile it into an executable file. When you run the executable file it will install the program to your computer (Depending on the size of your program this won't take long) after which you can run it just like a normal program
Tags :

Antileech
Help!!!...
At home I made a visual basic 2008 project. When I try to load it at school, it will not open because the school uses vb 2005, so I need to find away around this!
How can I save a 2008 project as a 2005 project?
Or are there any other ways....?

Thanks!

Ask your school technician to upgrade to VB 2008, or install VB 2005 on your home machine.
Saving a 2008 program as 2005 will cause certain scripts to not work due to differences in the language usage of the different versions
Tags :

Psycho Sweeney Todd
help please
i would like 2 have 2 pictureboxes moving at once but when they collide i would like them to bounce of so how do i do that on visual basic window part
Tags : contentbug

SmFaraujo
How do i...

can be able to view a pdf in a form or use a object to display a pdf

preciate all the help thanks...


mofonts
searching an excel
How do I open an excel file and search its contents (25 rows, 6 columns) for an integer value?
Tags :

Lukenji
How do I it?
I wanna my program choose, randomly, one number of a few numbers, for example, {1, 2, 3, 4, 5, 6, 7, 8, 9}, and set a variable to the chosed number.
Tags :

Lukenji
How do I use this VB6 codes in VB9?

Private Sub Drive1_Change()
Dir1.Path = Drive1.Drive
End Sub

Private Sub Dir1_Change()
File1.Path = Dir1.Path
Label1.Caption = File1.Path
End Sub

Private Sub File1_Click()
Label1.Caption = File1.Path & " " & File1.FileName
End Sub

Tags :

Want2bcomputergeek
How do I create a dialog box that display a message if a value is a decimal
Tags :

Want2bcomputergeek
How do I create a dialog box that display a message if a value is a decimal
Tags :

Want2bcomputergeek
How do I create a dialog box that display a message if a value is a decimal
Tags :

Want2bcomputergeek
How do I create a dialog box that display a message if a value is a decimal
Tags :

Want2bcomputergeek
How do I create a dialog box that display a message if a value is a decimal
Tags :

Want2bcomputergeek
How do I create a dialog box that display a message if a value is a decimal
Tags :

Want2bcomputergeek
How do I create a dialog box that display a message if a value is a decimal
Tags :

John1985
how do i do " find and display the names that are reapeated inthe text file?" VB.NET express
to find and display names that are repeated in a text file, assume that the file has already been sorted into alphabetical order, when a name is found to be reapeated , display it only once, i wonder wat code can be use and how to use it to do this ? can anyone help me out please?
Tags :

Nasadaws
Shortcuts?
I'm trying to make a coustum shortcut, Basicly...

So far i've got my form to be able to go to the Systemtray, but I want it to recognise keypresses when it's NOT got the form selected.

Also, if possible, could you please supply me with the code to add text to the selected box. E.g.

If i'm selected on a forums "Subject" box the program will add onto the text already there.
Thanks, RLR

that guy wolfgang
How do i make a basic web browser?
First off im very new, i tried one of the videos for starters and now i cant find it again. It showed me how to make a basic web browser, it really helped but i cant seem to find it again.

Please help, thanks

Never mind i figured out, thank you you tube
Tags :

darast
How do I play a video from recourse file?
I have added a video to my resource file and I want it to play on the Windows Media Player I have in Program. I can make the video play from the address from my documents by adding to the URL of the WMP but I want to know if theres a way to play it from the Resource file within the program.

Thanks.
Tags :

MV8
How do I print the sum of numbers divisible by 5??

How do I print the sum of numbers divisible by 5 IE (10,25,ETC )

Tags :

Vertically split screen
How do I split screen vertically on the same form?
How do I split screen vertically on the same form?
Thanks.

<a href="http://mcatprep.yolasite.com/">site</a>

Tags :

Bainco
Data connection....

Hi,
1. i am trying to add a connection to a database file using vb 2008.
when i right click Data connection then click add connection and select MS Access Database file i dont get the option to browse for my access file.

2. in college i could browse for the file and select it but when i right clicked on the entries i didnt get the option to retrive data. just copy, refresh and paste.

can you hep you help debug my brain of these two problems

Tags :

Page view tracker