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
Comments
Leave a comment