Hi everyone,
I am making a windows application and would appreciate if anyone out there can assist me in adding dynamic (PictureBox, Label and a listbox) for each CustomerID value in a table.
Just like an array in a group box.
If there are 5 customers details then when i load the form it will add (PictureBox, Label and a listbox) for each customer dynamically and display them with their information. Moreover, if i add 6th Customer information in the database then next time i load the form it should display his/her information as well.
I did this in VB6 sometimes back but need a start to do in .net
Thanx
Cheers
irfi
Private Sub LoadCustomerInformation()
Dim Qry As String
Dim RS As New Recordset
Dim i As Integer
Qry = "select * from Customer_Details
RS.Open Qry, db, adOpenDynamic, adLockOptimistic
Do While Not RS.EOF
If i = 0 Then
Image2(i).Picture = LoadPicture(RS!PicturePath)
LblID(i) = RS!IDNo
LblName(i) = RS!CustomerName
LblNationality(i) = RS!Nationality
Else
Load Image2(i)
Image2(i).Left = Image2(i - 1).Left + Image2(i - 1).Width + 250
Image2(i).Picture = LoadPicture(RS!PicturePath)
Image2(i).Visible = True
Load LblID(i)
LblID(i).Left = Image2(i - 1).Left + Image2(i - 1).Width + 250
LblID(i) = RS!IDNo
LblID(i).Visible = True
Load LblName(i)
LblName(i).Left = Image2(i - 1).Left + Image2(i - 1).Width + 250
LblName(i) = RS!CustomerName
LblName(i).Visible = True
Load LblNationality(i)
LblNationality(i).Left = Image2(i - 1).Left + Image2(i - 1).Width + 250
LblNationality(i) = RS!Nationality
LblNationality(i).Visible = True
End If
i = i + 1
RS.MoveNext
Loop
End Sub
I am making a windows application and would appreciate if anyone out there can assist me in adding dynamic (PictureBox, Label and a listbox) for each CustomerID value in a table.
Just like an array in a group box.
If there are 5 customers details then when i load the form it will add (PictureBox, Label and a listbox) for each customer dynamically and display them with their information. Moreover, if i add 6th Customer information in the database then next time i load the form it should display his/her information as well.
I did this in VB6 sometimes back but need a start to do in .net
Thanx
Cheers
irfi
Private Sub LoadCustomerInformation()
Dim Qry As String
Dim RS As New Recordset
Dim i As Integer
Qry = "select * from Customer_Details
RS.Open Qry, db, adOpenDynamic, adLockOptimistic
Do While Not RS.EOF
If i = 0 Then
Image2(i).Picture = LoadPicture(RS!PicturePath)
LblID(i) = RS!IDNo
LblName(i) = RS!CustomerName
LblNationality(i) = RS!Nationality
Else
Load Image2(i)
Image2(i).Left = Image2(i - 1).Left + Image2(i - 1).Width + 250
Image2(i).Picture = LoadPicture(RS!PicturePath)
Image2(i).Visible = True
Load LblID(i)
LblID(i).Left = Image2(i - 1).Left + Image2(i - 1).Width + 250
LblID(i) = RS!IDNo
LblID(i).Visible = True
Load LblName(i)
LblName(i).Left = Image2(i - 1).Left + Image2(i - 1).Width + 250
LblName(i) = RS!CustomerName
LblName(i).Visible = True
Load LblNationality(i)
LblNationality(i).Left = Image2(i - 1).Left + Image2(i - 1).Width + 250
LblNationality(i) = RS!Nationality
LblNationality(i).Visible = True
End If
i = i + 1
RS.MoveNext
Loop
End Sub