Public Class Form1
Dim text1 As New TextBox
Dim text2 As New TextBox
Dim WithEvents btn As New Button
Private Sub Form1_Load(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
'text3(i) =
New TextBox
text1.Visible = True
text1.Location = New Point(20, 20)
text1.Size = New
Size(150, 15)
Me.Controls.Add(text1)
text2.Visible = True
text2.Location = New Point(20, 40)
text2.Size = New
Size(150, 15)
Me.Controls.Add(text2)
btn.Visible = True
btn.Location = New
Point(20, 70)
btn.Size = New
Size(150, 40)
btn.Text = "Click"
Me.Controls.Add(btn)
End Sub
Private Sub btn_click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles btn.Click
MsgBox("Hi")
Dim a As Integer
Try
a = CInt(text1.Text)
\ CInt(text2.Text)
MsgBox("Result
" & a)
Catch
ex As DivideByZeroException
MsgBox(ex.Message)
End Try
End Sub
End Class
No comments:
Post a Comment
Note: only a member of this blog may post a comment.