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

Expert's answer

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 SubEnd 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!

LATEST TUTORIALS
APPROVED BY CLIENTS