Why not simply append the last name and first name and then add to the
listbox ?

---
lstStudents51.Items.Add(strSurname & ", " & strFirstName)
---

On Jan 9, 4:55 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

Reply via email to