Answer to Question #46281 in Visual Basic for Fel

Question #46281
write a VB window for application to find the area of a rectangle .

the program should;
1. accept numeric input

2.Clear the text boxes

3.Exit
1
Expert's answer
2014-09-24T03:50:50-0400
Public Class mainForm
''' <summary>
''' Calculate button click
''' </summary>
''' <param name="sender"></param>
''' <param name="e"></param>
''' <remarks></remarks>
Private Sub btnCalculate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCalculate.Click
Try
Dim a As Double = Double.Parse(txtA.Text)
Dim b As Double = Double.Parse(txtb.Text)
'calculate Area
txtArea.Text = (a * b).ToString()
Catch ex As Exception
'show error
MessageBox.Show("Enter correct data", "Input error", MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try

End Sub
''' <summary>
''' Clear button click
''' </summary>
''' <param name="sender"></param>
''' <param name="e"></param>
''' <remarks></remarks>
Private Sub btnClear_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClear.Click
txtA.Text = ""
txtb.Text = ""
txtArea.Text = ""
End Sub
''' <summary>
''' Exit button click
''' </summary>
''' <param name="sender"></param>
''' <param name="e"></param>
''' <remarks></remarks>
Private Sub btnExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnExit.Click
Me.Close() 'close form
End Sub
End Class

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS