Skip to main content

Multiplication Table in VB.NET


Hi! this is me again! For now we will have to create a Multiplication Table using VB.NET.

So, now let's start this tutorial!

1. Let's start with creating a Windows Form Application for this tutorial by following the following steps in Microsoft Visual Studio: Go to File, click New Project, and choose Windows Application.

2. Next, add Three TextBoxes namely TextBox1 for entering the first number, TextBox2 for entering the number limit, and TextBox3 for the result of the Multiplication Table. You must design your layout like this:

Design

3. Next, put this code in Button1_Click so that it will display the Multiplication table.

  1. Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
  2. Dim n1, n2, i As Integer
  3. n1 = Val(TextBox1.Text)
  4. n2 = Val(TextBox2.Text)
  5.  
  6. For i = 1 To n2
  7. Dim a As Integer
  8. a = n1 * i
  9. TextBox3.Text = TextBox3.Text & n1 & " * " & i & " = " & a
  10. TextBox3.Text = TextBox3.Text & vbCrLf
  11. Next
  12. End Sub

Explanation:

We initialized n1, n2 as Integer because we passed the value of our input in TextBox1 to n1 and TextBox2 to n2.

  1. For i = 1 To n2
  2. Dim a As Integer
  3. a = n1 * i
  4. TextBox3.Text = TextBox3.Text & n1 & " * " & i & " = " & a
  5. TextBox3.Text = TextBox3.Text & vbCrLf
  6. Next

For i = 1 To n2 - our variable i will start at 1 up to the n2 as we input it in TextBox2. Next, we initialized a as Integer to have the result of multiplication done in n1 up to the value of i which limits at n2. Then, TextBox3 will now have the value of n1*i = a. We use vbCrLf to create a newline.

Now, input 8 in TextBox1 and 10 in TexBox2 then click the Button. It will have a multiplication table like the image below.

output

Download the source code below and try it! :)

For more inquiries and need programmer for your thesis systems in any kind of programming languages, just contact my number below.

Best Regards,

Engr. Lyndon R. Bermoy
IT Instructor/System Developer/Android Developer
STI College - Surigao City
Mobile: 09488225971
E-mail:[email protected]

Follow and add me in my Facebook Account: https://www.facebook.com/donzzsky

Visit and like my page on Facebook at: https://www.facebook.com/BermzISware

Note: Due to the size or complexity of this submission, the author has submitted it as a .zip file to shorten your download time. After downloading it, you will need a program like Winzip to decompress it.

Virus note: All files are scanned once-a-day by SourceCodester.com for viruses, but new viruses come out every day, so no prevention program can catch 100% of them.

FOR YOUR OWN SAFETY, PLEASE:

1. Re-scan downloaded files using your personal virus checker before using it.
2. NEVER, EVER run compiled files (.exe's, .ocx's, .dll's etc.)--only run source code.

Submitted byLanceArellanGT (not verified)on Tue, 10/09/2018 - 18:22

How to code that is using Console Application, please i need that code

Add new comment

CAPTCHA
This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.