08-08-24, 12:26 PM
جرب هذا
PHP كود :
Public Class Form1
' زر البحث
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
' العمر الذي تريد البحث عنه
Dim searchAge As Integer = Integer.Parse(TextBox1.Text)
' إنشاء DataTable جديد لعرض النتائج
Dim resultsTable As New DataTable()
resultsTable.Columns.Add("Name")
resultsTable.Columns.Add("Age")
resultsTable.Columns.Add("Address")
' البحث في DataGridView1
For Each row As DataGridViewRow In DataGridView1.Rows
If Not row.IsNewRow Then
Dim age As Integer = Integer.Parse(row.Cells("Age").Value.ToString())
If age = searchAge Then
resultsTable.Rows.Add(row.Cells("Name").Value, age, row.Cells("Address").Value)
End If
End If
Next
' عرض النتائج في DataGridView2
DataGridView2.DataSource = resultsTable
End Sub
End Class

