VB
An object-oriented programming language developed by Microsoft that is implemented on the .NET Framework. Previously known as Visual Basic .NET.
2,713 questions
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
hello, I want to add the data I have taken to the form with the user control. but the items in the last column are coming, where am I doing wrong?
Try
Dim DB_Path As String = "Data Source=" & Application.StartupPath & "\Data.db;"
Dim conn As New SQLiteConnection(DB_Path)
conn.Open()
Dim SQL As String = "SELECT * from torrent;"
Dim da As New SQLiteDataAdapter(SQL, conn)
Dim ds As New DataSet
da.Fill(ds, "torrent")
conn.Close()
Dim Useram As New UserControl2
For i As Integer = 0 To ds.Tables(0).Rows.Count - 1
Useram.Label1.Text = ds.Tables(0).Rows(i).Item(0).ToString()
Useram.Label2.Text = ds.Tables(0).Rows(i).Item(1).ToString()
Useram.Label3.Text = ds.Tables(0).Rows(i).Item(2).ToString()
FlowLayoutPanel1.Controls.Add(Useram)
Next
Catch ex As Exception
MsgBox(ex.Message)
End Try
Try creating the control inside the loop:
For i As Integer = 0 To ds.Tables(0).Rows.Count - 1
Dim Useram As New UserControl2
. . .
Next