PROPERTIES:
CODEING:
RadioButton1 | |
Text | Square |
RadioButton2 | |
Text | Rectangle |
RadioButton3 | |
Text | Triangle |
Textbox1,Textbox2,Label1,Label2 | |
Text | (Empty) |
Label3 | |
Text | Select Any Shape |
Button1 | |
Text | OK |
Public Class Form1
Private Sub RadioButton1_CheckedChanged(sender As Object, e As EventArgs) Handles RadioButton1.CheckedChanged, RadioButton2.CheckedChanged, RadioButton3.CheckedChanged
If RadioButton1.Checked Then
Label1.Text = "Side"
TextBox1.Visible = True
TextBox2.Visible = False
Label2.Text = ""
ElseIf RadioButton2.Checked Then
Label1.Text = "Length"
TextBox1.Visible = True
Label2.Text = "Width"
TextBox2.Visible = True
Else
Label1.Text = "Base"
TextBox1.Visible = True
Label2.Text = "Height"
TextBox2.Visible = True
End If
TextBox1.Clear()
TextBox2.Clear()
Label3.Text = "Enter Number in Box"
End Sub
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
If RadioButton1.Checked Then
Label3.Text = "Area of Square is :" & Val(TextBox1.Text) ^ 2
ElseIf RadioButton2.Checked Then
Label3.Text = "Area of Rectangle is :" & Val(TextBox1.Text) * Val(TextBox2.Text)
ElseIf RadioButton3.Checked Then
Label3.Text = "Area of Triangle is :" & Val(TextBox1.Text) * Val(TextBox2.Text) / 2
End If
End Sub
End Class
DESIGNING:Private Sub RadioButton1_CheckedChanged(sender As Object, e As EventArgs) Handles RadioButton1.CheckedChanged, RadioButton2.CheckedChanged, RadioButton3.CheckedChanged
If RadioButton1.Checked Then
Label1.Text = "Side"
TextBox1.Visible = True
TextBox2.Visible = False
Label2.Text = ""
ElseIf RadioButton2.Checked Then
Label1.Text = "Length"
TextBox1.Visible = True
Label2.Text = "Width"
TextBox2.Visible = True
Else
Label1.Text = "Base"
TextBox1.Visible = True
Label2.Text = "Height"
TextBox2.Visible = True
End If
TextBox1.Clear()
TextBox2.Clear()
Label3.Text = "Enter Number in Box"
End Sub
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
If RadioButton1.Checked Then
Label3.Text = "Area of Square is :" & Val(TextBox1.Text) ^ 2
ElseIf RadioButton2.Checked Then
Label3.Text = "Area of Rectangle is :" & Val(TextBox1.Text) * Val(TextBox2.Text)
ElseIf RadioButton3.Checked Then
Label3.Text = "Area of Triangle is :" & Val(TextBox1.Text) * Val(TextBox2.Text) / 2
End If
End Sub
End Class
Comments
Post a Comment