06-12-14, 02:13 AM
هذا كود لملئء button لعلها تنفع الاخوة
con.Open()
Dim da As New OleDbDataAdapter("select * from ItemsCat", con)
Dim ds As New DataSet
da.Fill(ds, "ItemsCat")
con.Close()
Dim lastdsas As Integer = 0
Dim j As Integer = 0
Dim x As New Integer
Dim i As Integer
Dim b As Button = Nothing
For i = lastdsas To lastdsas + 8 - 1
If j = 0 Then b = Button2
If j = 1 Then b = Button3
If j = 2 Then b = Button4
If j = 3 Then b = Button5
If j = 4 Then b = Button6
If j = 5 Then b = Button7
If j = 6 Then b = Button8
If j = 7 Then b = Button9
j = j + 1
If ds.Tables("ItemsCat").Rows.Count > i Then
b.Text = ds.Tables("ItemsCat").Rows(i).Item("CatName")
b.Tag = ds.Tables("ItemsCat").Rows(i).Item("CatId")
End If
Next
con.Open()
Dim da As New OleDbDataAdapter("select * from ItemsCat", con)
Dim ds As New DataSet
da.Fill(ds, "ItemsCat")
con.Close()
Dim lastdsas As Integer = 0
Dim j As Integer = 0
Dim x As New Integer
Dim i As Integer
Dim b As Button = Nothing
For i = lastdsas To lastdsas + 8 - 1
If j = 0 Then b = Button2
If j = 1 Then b = Button3
If j = 2 Then b = Button4
If j = 3 Then b = Button5
If j = 4 Then b = Button6
If j = 5 Then b = Button7
If j = 6 Then b = Button8
If j = 7 Then b = Button9
j = j + 1
If ds.Tables("ItemsCat").Rows.Count > i Then
b.Text = ds.Tables("ItemsCat").Rows(i).Item("CatName")
b.Tag = ds.Tables("ItemsCat").Rows(i).Item("CatId")
End If
Next