Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I\'m new to VB and I need help with this so I can Identify where I place what st

ID: 3800825 • Letter: I

Question

I'm new to VB and I need help with this so I can Identify where I place what statement in the code window.

In Visual Basic, create a multiplication table using the following:

Open the VB2015Chap06MultiplicationSolution(MultiplicationSolution.sln) file.

Code the application to display a multiplication table similar to the one shown in Figure 6-31 (Zak, 2016).

Use the For...Next statement in the btnForNext_Click procedure, and use the Do...Loop statement in the btnDoLoop_Click procedure. Test the application appropriately.

Note: the existing code is as follows:

lbltable

for...next / do...loop

form

E Private sub lblTable Click (sender As object, e As Event Args) Handles lblTable.click End Sub End Class

Explanation / Answer

Creating a multiplication table:

/ To make this program works we have to tape the following code in your command button, this case is called Command1: /

Private Sub Command1_Click()   

List1.Clear

Dim n as integer

n=0

Do While n < 12

n = n + 1

r = Val(Text1.Text) * n

List1.AddItem (Text1.Text& "x" & n & " = " & r)

Loop

Text1.Text = ""

Text1.SetFocus

End Sub

Code Explanation:

List1.Clear: Each and Every time the code runs, it will clean the list box.

Dim n as integer: Here we declare the variable "n" which stores integer values.

n=0 : Here we give to the variable "n" the value 0. This way we initialize this variable which must not have a avlue to use the Do While.

Loop: In case of failure to comply the condition settled in the Do while it returns back, when the condition is met the Do while ends.

Text1.Text = "": Each time we press the multiply button, the Textbox value will be cleaned.

Text1.SetFocus: Return the cursor to the Text1.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote