Visual Basic

User Generated

ZnevPW720

Programming

Description

Beginner in Visual Basic (I use the 2017 version).

I need a For...Next Statement and Do...Loop statement for a multiplication (image attached). For..Next need to be coded to the btnForNext_Click and Do..Loop is for the btnDoLoop_Click

Unformatted Attachment Preview

User generated content is uploaded by users for the purposes of learning and should be used following Studypool's honor code & terms of service.

Explanation & Answer

Hello. The work is complete. Looking forwad to working with you. Good bye.. 😊

Surname 1
Name
Instructor
Institution
Course
Date
Updated Code:
' Name:

Multiplication Project

' Purpose:

Display a multiplication table that shows

'

the multiplicand, multiplier, and product

' Programmer: on
Option Explicit On
Option Strict On
Option Infer Off
Public Class frmMain

' For holding number
Dim num As Integer

' For storing result
Dim result As String

Surname 2

' Emptying result
result = String.Empty
' Reading value from text box
If Integer.TryParse(txtNumber.Text, num) Then
Dim i As Integer = 1
' Loop from 1 to 9
Do
' Adding items to result string
result &= num.ToString() & " * " & i.ToString() + " = " & (num * i).ToString()
& vbnewline
' Incrementing i value
i += 1
Loop While (i < 10)
' Writing data to label
lblTable.Text = result
Else
' If non numeric value is entered
MessageBox.Show("Only numeric... ")
End If

End Sub

Surname 3

' For holding number
Dim num As Integer

' For storing result
Dim result As String

' Emptying result
result = String.Empty
' Reading value from text box
If Integer.TryParse(txtNumber.Text, num) Then
' Loop from 1 to 9
For i = 1 To 9
' Adding data to label
result &= num.ToString() & " * " & i.ToString() + " = " & (num * i).ToString() &
vbnewline

Next

' Writing data to label
lblTable.Text = result

Surname 4
Else
' If non numeric value is entered
MessageBox.Show("Only numer...


Anonymous
I was having a hard time with this subject, and this was a great help.

Studypool
4.7
Indeed
4.5
Sitejabber
4.4

Related Tags