21-11-21, 12:24 AM
(20-11-21, 08:24 PM)سعود كتب : لو الراي عندي الغي الاضافة والتعديل من اداة شبيكة البيانات ويكون التحرير [اضافة حذف تعديل] من ادوات أخرى[مربعات نص ادوات تسمية ازرار] وهكذا.
![]()
PHP كود :
Public Class Form1
Private Function Gid() As Integer
Return dg.Rows.Count - IIf(dg.AllowUserToAddRows, 1, 0)
End Function
Private Sub selt()
txtname.Clear()
txtname.Focus()
txtname.Select()
dg.CurrentCell = dg.Rows(Gid() - 1).Cells(0)
dg.Rows(Gid() - 1).Selected = False
End Sub
Private Function Isfound(ByVal txt As String) As Boolean
For Each row As DataGridViewRow In dg.Rows
If row.Cells(1).Value = txt Then
Return True
End If
Next
Return False
End Function
Private Sub btnadd_Click(sender As Object, e As EventArgs) Handles btnadd.Click
If txtname.Text.Trim = "" Then Beep() : Exit Sub
If Isfound(txtname.Text) = False Then
dg.Rows.Add(Gid() + 1, txtname.Text)
selt()
Else
Beep() : selt()
End If
End Sub
End Class
مشكور اخي سعود الف شكر لك
جهودك جبارة و حلولك رائعة

