Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles butLogin.Click
If TextBox1.Text = "user" And TextBox2.Text = "pass" Then
Dim main As New Form2
main.MdiParent = Me
main.Show()
Else
MsgBox("ผิด")
End If
End Sub
End Class
อยากให้ หน้า form 1 หายไปอ่ะครับ ตอนที่ form 1 เรียกใช้ form 2
Public Class Form2
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
lblName.Text = TextBox1.Text
lblFname.Text = TextBox2.Text
lblTel.Text = TextBox3.Text
lblEmail.Text = TextBox4.Text
lblPass.Text = "*********"
If (TextBox6.Text = TextBox5.Text) Then
lblCpass.Text = TextBox5.Text
Else
MsgBox("ใส่พาสเวิดไม่เหมือนกัน")
End If
lblDate.Text = dateTime.Value
If (radioM.Checked = True) Then
lblSex.Text = "ชาย"
ElseIf (radioF.Checked = True) Then
lblSex.Text = "หญิง"
Else
MsgBox("กรุณาเลือกเพศ")
End If
'lblCity.Visible = comCity.SelectedValue
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles butExit.Click
Dim butExit As Integer
butExit = MsgBox("ต้องการออกจากระบบ", MsgBoxStyle.OkCancel, "ยืนยันการออกระบบ")
If (butExit = 1) Then
End
End If
End Sub
End Class
Date :
2012-12-25 10:38:28
By :
dawud125
No. 8
Guest
Code (VB.NET)
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles butLogin.Click
If TextBox1.Text = "user" And TextBox2.Text = "pass" Then
Dim main As New Form2
main.MdiParent = Me '<---- มาไง
main.Show()
Else
MsgBox("ผิด")
End If
End Sub
End Class