Resources » Code Snippets » Winforms Controls

GUI Multiplication Table


Posted Date: 10-Nov-2009  Last Updated:   Category: Winforms Controls    
Author: Member Level: Gold    Points: 7



GUI Multiplication Table



This code is shows how to create multiplication table in vb.net. Open a new windows project, place 2 textbox, list box and a button. In the button click write the following code.


Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If TextBox1.Text <> "" And TextBox2.Text <> "" Then
' First Number is used to get the value from
' which number the multiplication start ie 1
' Second number used to get the end value
' ie 10,20
Dim firstNumber As Integer = Val(TextBox1.Text)
Dim secondNumber As Integer = Val(TextBox2.Text)
Dim multplier As Integer = 2 ' modify these value for 3,4
' for the corresponding table
Dim answer As Integer
Do While multplier < 3
For i = firstNumber To secondNumber
answer = i * multplier
' 1* 2= 2
'All the result will get appended to the listbox
lstTables.Items.Add(i & " * " & multplier & " = " & answer)
Next
multplier = multplier + 1
Loop
Else
Exit Sub
End If
End Sub


Did you like this resource? Share it with your friends and show your love!

Responses to "GUI Multiplication Table"
Author: Abhay Kumar Raut    10 Nov 2009Member Level: Gold   Points : 1
Hi Dharmaraj,

Can you please add some comment lines in the code?

Thanks,
Abhay



Feedbacks      

Post Comment:




  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name:   Sign In to fill automatically.
    Email: (Will not be published, but required to validate comment)



    Type the numbers and letters shown on the left.


    Submit Article     Return to Article Index

    Subscribe to Subscribers
    Active Members
    TodayLast 7 Daysmore...

    Awards & Gifts
    Talk to Webmaster Tony John

    Online Members

    Suresh
    More...
    Copyright © SpiderWorks Technologies Pvt Ltd., Kochi, India