Basics of VB Programming Los Angeles CA

This article is designed to help beginners get to grips with some basic functions in VB.

Local Companies

Moyea Software
92295612365
Hot building, ring street
LA, CA
Interneer Inc.
8005586832 x85
6101 W. Centinela Ave.
Culver City, CA
Cornerstone Concepts Inc
818-247-3909
600 W Broadway
Glendale, CA
Greene Computer Corporation
(818) 956-4961
200 S. Louise Street
Glendale, CA
Corticalx Inc Software Solutions & Technology
818-500-0881
425 E Colorado St
Glendale, CA
Alphatier Systems
818-409-8920
517 Griswold St
Glendale, CA
TimeTECH - Customizable Time and Attendance / Workforce Management Solutions
905-677-7009
7420 Airport Rd 203
Mississauga, CA
Hutchinson & Bloodgood, LLP
(818) 637-5000
101 N. Brand Blvd. #1600
Glendale, CA
Telsoft Solutions
818-545-8680
100 N Brand Blvd
Glendale, CA
Abraxas Technologies Inc
818-502-9100
450 N Brand Blvd
Glendale, CA

provided by: 
Originally published at Internet.com


This article is designed to help beginners get to grips with some basic functions in VB. The following things are covered: * Message Boxes * Input Boxes * For..Next * Do..Loop * If..Then..Else

Message Boxes are used to display information to the user. You see them all the time in Windows and other programs.

Message boxes can be called like this:

MsgBox Prompt, Buttons/Icon, Title

The prompt is basically what you want it to say, the buttons/icon is what buttons you want and which icon you want and title is really self explanatory. e.g. Msgbox "This is a test.",vbCritical,"Title"

You can use the following constants for buttons: * vbOkOnly * vbOkCancel * vbYesNo * vbYesNoCancel * vbAbortRetryIgnore * vbRetryCancel

and these constants for icons: * vbQuestion * vbInformation * vbExclamation * vbCritical

An important thing that you need to be able to do is to translate what the user has done. e.g. Dim iRes As Integer iRes=MsgBox("Test Question?",vbYesNo+vbQuestion,"Title" If iRes=vbYes Then Msgbox "The Yes button was clicked." Else Msgbox "The No button was clicked." End If

To include the contents of a control, such as a text box, you can use the ampersand character (&) to concentate the prompt string (see No Strings Attached). e.g. Msgbox "The contents is:" & Text1.Text

The input box is a useful way of getting the user to input a string or other data type.

Input boxes can be called like this:

InputBox Prompt, Title, DefaultValue

The prompt is the same for the message box and so is the title, the default value can be left as blank if you don't want anything to appear. e.g. InputBox "This is a test.","Title","Hi there!"

The InputBox always returns a string data type, so in some circumstances you may want to convert it to a number. To do this you can use the Val() function. e.g. Val(InputBox("This is a test.","Title","9"

This would return the string value of 9 as an integer value.

You may want to check if the input from the user is nothing, or hasn't changed. e.g. Dim sText Dim sValue sValue="Hi there!" sText=InputBox("This is a test.","Title",sValue) 'Check for nothing If sText="" Then Msgbox "No text" 'Check for no change If sText=sValue Then Msgbox "No change."

The For..Next statement is an easy way to control program flow. e.g. Dim i As Integer Dim iValue As Integer For i=0 To 10 iValue=0+1 Next i

In this situation iValue will equal 0 at the start and will increase by 1 every time until it reaches 10.

This can be used to process items from a list box. e.g. Dim i As Integer For i=0 To List1.ListCount List2.AddItem List1.List(i) Next i

This code copies all the list items from List1 to List2.

The Do..Loop is a good way to loop a certain condition depending on different criteria. e.g. Do Msgbox "Hi" Loop

The problem with this code is that it will keep on going forever. You can of course set certain conditions. e.g. Dim i As Integer i=10 Do While i>0 i=i-1 Loop

This code will count down from 10 and when i is 0, the loop ends. Another use of this loop is: Dim i As Integer i=10 Do Until i=0 i=i-1 Loop

This code will continue until i is 0, and then stop.

The If..Then..Else statement is one used a lot by programmers. It checks if a certain condition is true and then executes a statement. The Else statement is used if the statement does not comply with the criteria. e.g. Dim i As Integer i=10 If i=10 Then Msgbox "i=10" Else Msgbox "i is not 10" End If

You can also use nested If..Then..Else statements. e.g. Dim i As Integer i=10 If i=10 Then If i>9 Then Msgbox "i>9" Else Msgbox "i<9" End If Msgbox "i=10" Else Msgbox "i does not = 10" End If

Easy.

Author: Sam Huggill

Read article at Internet.com site

Featured Local Company

Moyea Software

92295612365
Hot building, ring street
LA, CA

Related Local Events
Automation Technology Expo West (ATX West)
Dates: 2/9/2010 - 2/11/2010
Location: Anaheim Convention Center
Anaheim, CA
View Details

SOLAR POWER - Exhibition and Conference
Dates: 10/12/2010 - 10/14/2010
Location: Los Angeles Convention & Exhibition Center
Los Angeles, CA
View Details

REAL-TIME & EMBEDDED COMPUTING CONFERENCE - LONG BEACH 2009
Dates: 10/1/2009 - 10/1/2009
Location: Marriott Long Beach
Long Beach, CA
View Details

2009 IEEE Petroleum and Chemical Industry Technical Conference (PCIC 2009)
Dates: 9/14/2009 - 9/16/2009
Location:
Anaheim, CA
View Details

Medical Design & Manufacturing - Trade
Dates: 6/9/2009 - 6/11/2009
Location: CANON COMMUNICATIONS LLC
Los Angeles, CA
View Details