[x]
Ever Worried about Missed / Lost Mobile Phone (or) Mobile Phone Theft ?
Use GinGly to Save your Mobile Numbers and Useful Messages
Limited Time Free Access .Hurry Up !!!
Login
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
Resend Activation Email
|
Forgot your Password?
Join IT Acumens Discussion Zone Free!
Welcome,
Guest
. Please
login
or
register
.
September 02, 2010, 11:34:11 PM
Home
Search
Team
Calendar
Gallery
Contact
Downloads
GoogleTagged
Login
Register
IT Acumens Discussion Zone
»
Tech News
»
Programming Discussions for Engineers
»
Programming in .NET
(Moderators:
VelMurugan
,
thiruvasagamani
,
nandagopal
) »
Try this Sample code - VB Net
« previous
next »
Reply
Print
Register to comment on this topic
Pages: [
1
]
Author
Topic: Try this Sample code - VB Net (Read 486 times)
sukishan
Hero Member
Posts: 2918
Acumen
Try this Sample code - VB Net
«
on:
July 11, 2009, 06:54:56 PM »
Quote
A Time Table Programme...
Start a new project for this. Onto your new Form, place two textboxes and a Button. Set the Text property of Textbox1 to 1, and the Text property of Textbox2 to 10. Set the Text property of the Button to "Go".
When the Go button is clicked, the programme will put the numbers from the Textbox into two variables. We'll then put a value into a variable called multiplier. If you're doing the times tables, the format is
X multiplied by Y = Z
(2 multiplied by 3 = 6)
We'll use a Do Loop to work out the multiplier (that's the Y part); a For Loop will work out the rest. We'll then display the results in something called a Listbox.
So add a List Box to your form. It looks like this in the toolbox:
The form you design should look something like this one:
A List box is similar to a Combo Box, in that you have a list of items that the user can select. Here, we're just using it display the results of our programme. We'll add items to the List box with our code, rather than in design time like we did for the Combo box.
So, here's the code for the entire programme. Double click your Go button, and add the following:
Dim number1 As Integer
Dim number2 As Integer
Dim multiplier As Integer
Dim answer As Integer
Dim i As Integer
number1 = Val(TextBox1.Text)
number2 = Val(TextBox2.Text)
multiplier = 2
Do While multiplier < 3
For i = number1 To number2
answer = i * multiplier
ListBox1.Items.Add(i & " Times " & multiplier & " = " & answer)
Next i
multiplier = multiplier + 1
Loop
When you've finished, run the programme and see how it works.
Logged
A good beginning makes a good ending
Reply
Print
Register to comment on this topic
Pages: [
1
]
« previous
next »
IT Acumens Discussion Zone
»
Tech News
»
Programming Discussions for Engineers
»
Programming in .NET
(Moderators:
VelMurugan
,
thiruvasagamani
,
nandagopal
) »
Try this Sample code - VB Net
GoogleTagged
box
items
combo
google
add
list
net
sample
example code loopoing net for
programe