Visual Basic.Net
Earl T. Wylie
CIS 1
Days, TTr Time 6:00pm
Semester Summer 11
Date 6/23/2011
Instructor Name: Earl T. Wylie, Ph.D.
Assignment: Lesson experiment Number Page
Lab experiment
Problem – create a program in vb that take input from the keyboard
into a text box and then display the input in a label on the form.
Also put a picture on the form with a btn to display the picture. Put
a btn to exit the program and one to execute the program.
Analysis IPO.
Data Requirements :
Constants none
Inputs name of person
Outputs label with person name, display picture
Variables strname
Formulas none
Design
Algorithm
1. Create vb program
2. variable = strname,
3. labels – lbloutput, 8 pt, aerial, blue, text=strname
4. label- no name, text=enter name, 8 pt, aerial, pink
5. picture box=picsunset, picture=sunset.jpg. mode-
stretch
6. btn = btn exit, text=&Exit, 8 pt, aerial, green,
code=me.close()
7 btn=btnexecute, text=&execute, 8 pt, aerial, green,
code – move text box into variable, move variable into lbloutput.
8. btn=btndisplay, text &display, 8 pt. aerial, green,
code-make picture box visible
Implementation –
Private Sub btnexit_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnexit.Click
Me.Close()
End Sub
Private Sub btndisplay_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles btndisplay.Click
picimage.Visible = True
End Sub
Private Sub btnexecute_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles btnexecute.Click
Dim strname As String
strname = txtname.Text
lbloutput.Text = strname
End Sub
Private Sub btnreset_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles btnreset.Click
lbloutput.Text = " "
txtname.Text = " "
picimage.Visible = False
End Sub
Output:
Flow Chart:
start
Display Display Reset
Exit Name
Picture
Get name from Clear txtname,
Me.close() Picimage.visi txtname and lbloutput,
ble=true move into picimage.visible
variable =false
ststrname and
then move into
lbloutput
Clear
Display Form
Picture Display
on Form Name
Stop
on
Label