19-01-17, 08:49 PM
السلام عليكم
ممكن مساعدة يا اخواني في هذا الكود
عند كتابة اسم المعرف في ليبيل ال ID يظهر لي اسم الصنف في التيكست بوكس الخاص به
ولكني أريد كتابة اسم الصنف بدلا من اسم المعرف ، ولكن يبدو ان هذه الخاصية لا تدعم كتابة النصوص
أرجو منكم المساعدة
Private Sub txtLabel_KeyDown(sender As Object, e As KeyEventArgs) Handles txtLabel.KeyDown
If e.KeyCode = Keys.Enter Then
Try
cmd = New OleDb.OleDbCommand("select Price from TBL_PRODUCTS where Label = " & txtLabel.Text, con)
con.Open()
Dim dr As OleDb.OleDbDataReader = cmd.ExecuteReader
dr.Read()
If dr.HasRows Then
txtPrice.Text = dr(0)
txtQty.Focus()
Else
MsgBox("الصنف غير موجود", MsgBoxStyle.Exclamation, "تنبيه")
txtLabel.Clear()
txtQty.Clear()
txtPrice.Clear()
txtAmount.Clear()
txtLabel.Focus()
End If
dr.Close()
Catch ex As Exception
Exit Sub
Finally
con.Close()
End Try
End If
End Sub
ممكن مساعدة يا اخواني في هذا الكود
عند كتابة اسم المعرف في ليبيل ال ID يظهر لي اسم الصنف في التيكست بوكس الخاص به
ولكني أريد كتابة اسم الصنف بدلا من اسم المعرف ، ولكن يبدو ان هذه الخاصية لا تدعم كتابة النصوص
أرجو منكم المساعدة
Private Sub txtLabel_KeyDown(sender As Object, e As KeyEventArgs) Handles txtLabel.KeyDown
If e.KeyCode = Keys.Enter Then
Try
cmd = New OleDb.OleDbCommand("select Price from TBL_PRODUCTS where Label = " & txtLabel.Text, con)
con.Open()
Dim dr As OleDb.OleDbDataReader = cmd.ExecuteReader
dr.Read()
If dr.HasRows Then
txtPrice.Text = dr(0)
txtQty.Focus()
Else
MsgBox("الصنف غير موجود", MsgBoxStyle.Exclamation, "تنبيه")
txtLabel.Clear()
txtQty.Clear()
txtPrice.Clear()
txtAmount.Clear()
txtLabel.Focus()
End If
dr.Close()
Catch ex As Exception
Exit Sub
Finally
con.Close()
End Try
End If
End Sub