C
cjobes
Hi all,
I need to populate a listbox from a table column. The column has multiple
entries of usernames and I need to pull a unique set of usernames. The table
is part of an untyped Dataset that is created during runtime. There is no
DataAdapter. On an SQL server I would just pull a Unique Set but that
doesn't seem to be an option in my case. So I created the code below. It
works but it is very slow bringing up the list box. Is there a better way of
doing this?
Also, after the listbox is displayed how can I capture which username(s) the
user has highlighted when he/she clicks on a button called "doIt".
Public Sub selList()
Dim dcPick As New DataColumn("User", GetType(String))
dcPick.Unique = True
tbPick.Columns.Add(dcPick)
Dim pRows() As DataRow = _dt.Select()
Dim pSel As DataRow
For Each pSel In pRows
Try
tbPick.ImportRow(pSel)
Catch
Exit Try
End Try
Next
End Sub
Thanks for your help,
Claus
I need to populate a listbox from a table column. The column has multiple
entries of usernames and I need to pull a unique set of usernames. The table
is part of an untyped Dataset that is created during runtime. There is no
DataAdapter. On an SQL server I would just pull a Unique Set but that
doesn't seem to be an option in my case. So I created the code below. It
works but it is very slow bringing up the list box. Is there a better way of
doing this?
Also, after the listbox is displayed how can I capture which username(s) the
user has highlighted when he/she clicks on a button called "doIt".
Public Sub selList()
Dim dcPick As New DataColumn("User", GetType(String))
dcPick.Unique = True
tbPick.Columns.Add(dcPick)
Dim pRows() As DataRow = _dt.Select()
Dim pSel As DataRow
For Each pSel In pRows
Try
tbPick.ImportRow(pSel)
Catch
Exit Try
End Try
Next
End Sub
Thanks for your help,
Claus