Hi,
I have a form that has about 25 textboxes. I then have a column in a
DB that has 20/25 rows. I need fill the textboxes with the data from
that column in the database - i.e. row1 = textbox1, row2 = textbox2,
etc.
Do I need some kind of array or a loop? Also, I know about the
multiline property of textbox and that isnt really what I need here.
Thanks!
CODEPublic Sub FillStudentList()
'get a selected ClassID based on the selection from the
combobox and use the data
'relationships to find rows in the student table which match
the selected ClassID
'Iterate through the array and for each record add the surname
and the first name
' in the current student record.
Dim selClass As String =
cboClassSelection.SelectedValue.ToString
Dim classRow As DataRow = objDataSet.Tables
("tblClass").Rows.Find(selClass)
If classRow IsNot Nothing Then
'use the data relationship to find all matching student
rows
Dim studentRows() As DataRow = classRow.GetChildRows
("Class2Student")
If studentRows.Length > 0 Then
For Each student As DataRow In studentRows
Dim strSurname As String = student("SName")
Dim strFirstName As String = student("FName")
'add this information to the textboxes
txtName1.Text = (strSurname + ", " + strFirstName)
Next
Else
'this class has no students
End If
Else
'this class does not exist
End If
End Sub