المشاركات : 47
المواضيع 16
الإنتساب : Dec 2018
السمعة :
3
الشكر: 5
تم شكره 33 مرات في 19 مشاركات
السلام عليكم ورحمة الله وبركاته
وكا عام وانتم بالف خير
ممكن المساعدة في تحديد نقطة واحدة (فاصلة عشرية ) في كتابة الرقم في حقل ال datagridview ...فقد قمت بذلك في textbox كما يلي :
Private Sub textbox1_KeyPress(sender As Object, e As KeyPressEventArgs) Handles textbox1.KeyPress
' حدث كتابة أرقام فقط في الحقل
If Asc(e.KeyChar) <> 8 Then
If Asc(e.KeyChar) < 46 Or Asc(e.KeyChar) > 57 Then
e.Handled = True
End If
End If
If textbox1.Text.Contains(".") Then
If e.KeyChar = "." Then
e.Handled = True
End If
End If
End Sub
كيف يمكن ذلك في حق ال datagridview
وبارك الله بكم
المشاركات : 47
المواضيع 16
الإنتساب : Dec 2018
السمعة :
3
الشكر: 5
تم شكره 33 مرات في 19 مشاركات
السلام عليكم ورحمة الله وبركاته
أشكر لكم مروركم... وكل عام وانتم بالف خير ...
واجهة مشكلة في كتابة الكود ...
Private Sub DGVewItems_KeyPress(sender As Object, e As KeyPressEventArgs) Handles DGVewItems.KeyPress
If Asc(e.KeyChar) <> 8 Then
If Asc(e.KeyChar) < 46 Or Asc(e.KeyChar) > 57 Then
e.Handled = True
End If
End If
If sender.Text.Contains(".") Then
If e.KeyChar = "." Then
e.Handled = True
End If
End If
End Sub
Private Sub DGVewItems_GotFocus(sender As Object, e As EventArgs) Handles DGVewItems.GotFocus
RemoveHandler sender.EditingControlShowing, AddressOf DGVewItems_EditingControlShowing
AddHandler sender.EditingControlShowing, AddressOf DGVewItems_EditingControlShowing
End Sub
Private Sub DGVewItems_EditingControlShowing(ByVal sender As Object, ByVal e As DataGridViewEditingControlShowingEventArgs)
If sender.CurrentCell.ColumnIndex = 13 Then ' <<<< ColumnIndex
Dim TB = CType(e.Control, TextBox)
RemoveHandler TB.KeyPress, AddressOf DGVewItems_KeyPress
AddHandler TB.KeyPress, AddressOf DGVewItems_KeyPress
End If
End Sub
أن كل من sender.EditingControlShowing و sender.EditingControlShowing يشار لها بالخطأ
class.system.object
supports all classes in the .net framework class hierarchy and providers low -level services to derived classes. this ultimate base class of classes in the .net framework it is the root of the type hierarchy . to browse the .net framework source code for this type , see the references source. "EditingControlShowing" is not an event of "Object"
المشاركات : 47
المواضيع 16
الإنتساب : Dec 2018
السمعة :
3
الشكر: 5
تم شكره 33 مرات في 19 مشاركات
السلام عليكم ورحمة الله وبركاته
أشكر لكم مروركم...
ولكن لم تتحق النتيجة ...
المشاركات : 47
المواضيع 16
الإنتساب : Dec 2018
السمعة :
3
الشكر: 5
تم شكره 33 مرات في 19 مشاركات
السلام عليكم ورحمة الله وبركاته
أشكر لكم مروركم...
وبارك الله بكم ....
الكود يعمل بشكل ممتاز ....