1
General Programming / Re: อยากลองทำวิธี login แบบนี้ครับ (vb2010)
« เมื่อ: 20 สิงหาคม 2012, 13:25:43 »จัดให้
LOGIN Sampleโค๊ด: [Select]'Your password = zone-it
Public Class Form1
Private form2 As New System.Windows.Forms.Form
Private label1 As New System.Windows.Forms.Label
Private textbox1 As New System.Windows.Forms.TextBox
Private button1 As New System.Windows.Forms.Button
Public Sub New()
InitializeComponent()
AddHandler button1.Click, AddressOf button1_Click
AddHandler form2.FormClosed, AddressOf form2_FormClosed
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
form2.Text = "Login Sample"
label1.Text = "Enter: Your Password"
button1.Text = "เข้าสู่ระบบ"
label1.Bounds = New Rectangle(70, 30, 200, 20)
textbox1.Bounds = New Rectangle(70, 50, 150, 30)
button1.Location = New Point(105, 100)
button1.Cursor = Cursors.Hand
form2.Bounds = New Rectangle(300, 300, 300, 180)
form2.StartPosition = FormStartPosition.CenterScreen
form2.Controls.AddRange(New Control() {label1, textbox1, button1})
form2.ShowDialog()
End Sub
Public Sub button1_Click(ByVal senser As System.Object, ByVal e As System.EventArgs)
Select Case textbox1.Text
Case Nothing
MsgBox("กรุณากรอกรหัสลงในช่อง", MsgBoxStyle.OkOnly, "")
Case "zone-it"
form2.Hide()
Me.Show()
Label2.Text = "Welcome to zone-it"
Case Else
MsgBox("รหัสผิด! ลองใหม่", MsgBoxStyle.Critical, "")
End Select
End Sub
Public Sub form2_FormClosed(ByVal sender As System.Object, ByVal e As System.EventArgs)
Me.Close()
End Sub
End Class
ช่วยแนะนำหรือให้ความหมายการใช้งานแต่ละตัวทีครับ มาเก็บความรู้ ขอบคุณครับ

