my code for retrieving values from database
Dim da As New SqlDataAdapter( "select parameter_name, parameter_units from sys_params", con)
If con.State = ConnectionState .Closed Then
con.Open()
End If
Dim ds As New DataSet
Dim name, unit ,namunt As String
da.Fill(ds, "sys_params ")
For Each r In ds.Tables(0).Ro ws
name = r.Item("paramet er_name")
unit = r.Item("paramet er_units")
namunt = name & "," & unit
next
code for dynamic labels and textboxes
For i = 0 To inttxtcnt
Dim newcontrol As New TextBox
Dim NewLablecontrol As New Label
'Assign the Location for Dynamic controls for Textbox and Labelcontrol
newcontrol.Top = 20 * i
NewLablecontrol .Top = 20 * i
newcontrol.Left = 80
'Assign the Text for Lable controls
NewLablecontrol .Text = namunt
Me.Controls.Add (NewLablecontro l)
Me.Controls.Add (newcontrol)
Next i
two codes are working fine.
but here my problem is a first retrieving value from database is assiging to first label
second value to second label.
and so on...........
so may be i think it is possible through nested loops
so anyone please help me with the code
Dim da As New SqlDataAdapter( "select parameter_name, parameter_units from sys_params", con)
If con.State = ConnectionState .Closed Then
con.Open()
End If
Dim ds As New DataSet
Dim name, unit ,namunt As String
da.Fill(ds, "sys_params ")
For Each r In ds.Tables(0).Ro ws
name = r.Item("paramet er_name")
unit = r.Item("paramet er_units")
namunt = name & "," & unit
next
code for dynamic labels and textboxes
For i = 0 To inttxtcnt
Dim newcontrol As New TextBox
Dim NewLablecontrol As New Label
'Assign the Location for Dynamic controls for Textbox and Labelcontrol
newcontrol.Top = 20 * i
NewLablecontrol .Top = 20 * i
newcontrol.Left = 80
'Assign the Text for Lable controls
NewLablecontrol .Text = namunt
Me.Controls.Add (NewLablecontro l)
Me.Controls.Add (newcontrol)
Next i
two codes are working fine.
but here my problem is a first retrieving value from database is assiging to first label
second value to second label.
and so on...........
so may be i think it is possible through nested loops
so anyone please help me with the code
Comment