You cna add this code
For i = 1 To objDataSet.Tables("tblStudent").Rows.Count
strfullname = objDataSet.Tables("tblStudent").Rows(i -
1).Item("SName") & " " & objDataSet.Tables("tblStudent").Rows(i -
1).Item("FName")
lstStudents51.Items.Add(strfullname )
Next
On Fri, Jan 9, 2009 at 5:25 PM, Laura <[email protected]> wrote:
>
> Hi,
>
> I have a database, one table contains a field "FName" and a field
> "SName".
> I can successfully read the FName and the SName into my application.
> However, I need to get them to read in, in the format: SName,FName as
> currently I can only get them to come in seperately. How can I do
> this? (the surnames and first names are being read into a listbox)
>
> Thanks.
>
> (below is the code I have so far)
> lstStudents51.Items.Clear()
>
> Dim i As Integer
> Dim strSurname As String
> Dim strFirstName As String
> For i = 1 To objDataSet.Tables("tblStudent").Rows.Count
> strSurname = objDataSet.Tables("tblStudent").Rows(i -
> 1).Item("SName")
> strFirstName = objDataSet.Tables("tblStudent").Rows(i -
> 1).Item("FName")
> lstStudents51.Items.Add(strSurname)
> lstStudents51.Items.Add(strFirstName)
>
> Next
>
> lstStudents51.SelectedIndex = 0
>