Private Sub Txt_Pri_SelectedIndexChanged(sender As Object, e As EventArgs) Handles Txt_Pri.SelectedIndexChanged
'code
End Sub
อยากจะป้องกันการพิมพ นอหเหนือจากข้อมูลใน combobox
Code (VB.NET)
Private Sub Txt_Status_TextChanged(sender As Object, e As EventArgs) Handles Txt_Status.TextChanged
For index As Integer = 0 To (Txt_Status.Items.Count - 1)
If Txt_Status.Text = Txt_Status.Items(index).ToString() Then
Else
Txt_Status.Text = ""
End If
Next
End Sub
Private Sub Txt_Pri_SelectedIndexChanged(sender As Object, e As EventArgs) Handles Txt_Pri.SelectedIndexChanged
checkbox1.checked = true
End Sub
เวลา User พิมพ์ ใน Combobox เราก็สั่ง คำสั่งนี้ไว้เพื่อให้ให้ พิมพ์ได้ Code (VB.NET)
Private Sub Txt_Status_TextChanged(sender As Object, e As EventArgs) Handles Txt_Status.TextChanged
For index As Integer = 0 To (Txt_Status.Items.Count - 1)
If Txt_Status.Text = Txt_Status.Items(index).ToString() Then
Else
Txt_Status.Text = ""
End If
Next
End Sub
พอก็ search Code (VB.NET)
If checkbox1.checked Then
// ตามที่ wathotza เขียนอยู่ก็ได้ครับ
endif
Private Sub Form_Load(sender As Object, e As EventArgs) Handles Me.Load
Dim cboTestData = {New With {.ID = "add_firstname", .Name = "ค้นหาตามชื่อ"},
New With {.ID = "add_lastname", .Name = "ค้นหาตามนามสกุล"},
New With {.ID = "add_nickname", .Name = "ค้นหาตามชื่อเมียน้อย"},
New With {.ID = "add_department", .Name = "ค้นหาตามชื่อน้องเมียสุดที่รัก"}
}
cboARTCode.DataSource = cboTestData 'cboTestData.ToList()
cboARTCode.DisplayMember = "Name"
cboARTCode.ValueMember = "ID"
End Sub
Private Sub cboARTCode_SelectedIndexChanged(sender As Object, e As EventArgs) Handles cboARTCode.SelectedIndexChanged
Dim sField As String = cboARTCode.SelectedValue
Dim makeLOVE As String = "Select * From Table Where 'หอย' = 'หอย'"
If Not String.IsNullOrEmpty(sField) Then
makeLOVE = makeLOVE + " And " + sField + " Like '" + TextBox10.Text + "%'"
End If
EXECUTESQLQuery()
End Sub
Private Sub cboARTCode_SelectedIndexChanged(sender As Object, e As EventArgs) Handles cboARTCode.SelectedIndexChanged
Dim sField As String = cboARTCode.SelectedValue
Dim makeLOVE As String = "Select * From Table Where 'หอย' = 'หอย'"
If Not String.IsNullOrEmpty(sField) Then
makeLOVE = makeLOVE + " And " + sField + " Like '" + TextBox10.Text + "%'"
End If
EXECUTESQLQuery()
End Sub