07-10-17, 03:35 PM
اريد عند الضغط على انتر في cell معينة يتم تنفيذ كود
انا الكود اللي درته هذا بس ينزل للسطر اللي في الاسفل قبل ما اينفذ اللي نبيه الرجاء الرد ضروري ضروري
Private Sub DataGridView1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles DataGridView1.KeyPress
If DataGridView1.RowCount > 0 And e.KeyChar = Chr(13) Then
Dim a As Integer
Dim d As Double
Dim sql1 As String = "select * from mstor where num=" & DataGridView1.CurrentRow.Cells("num").Value & ""
adpfa1 = New SqlDataAdapter(sql1, Connect)
adpfa1.Fill(dsfa, sql1)
dtfa1 = dsfa.Tables(sql1)
a = DataGridView1.CurrentRow.Cells("qu").Value
If dtfa1.Rows.Count > 0 Then
d = a * Val(dtfa1.Rows(0).Item("sss"))
DataGridView1.CurrentRow.Cells("g").Value = Val(d.ToString)
del()
add()
End If
End If
End Sub
انا الكود اللي درته هذا بس ينزل للسطر اللي في الاسفل قبل ما اينفذ اللي نبيه الرجاء الرد ضروري ضروري
Private Sub DataGridView1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles DataGridView1.KeyPress
If DataGridView1.RowCount > 0 And e.KeyChar = Chr(13) Then
Dim a As Integer
Dim d As Double
Dim sql1 As String = "select * from mstor where num=" & DataGridView1.CurrentRow.Cells("num").Value & ""
adpfa1 = New SqlDataAdapter(sql1, Connect)
adpfa1.Fill(dsfa, sql1)
dtfa1 = dsfa.Tables(sql1)
a = DataGridView1.CurrentRow.Cells("qu").Value
If dtfa1.Rows.Count > 0 Then
d = a * Val(dtfa1.Rows(0).Item("sss"))
DataGridView1.CurrentRow.Cells("g").Value = Val(d.ToString)
del()
add()
End If
End If
End Sub