471,339 Members | 1,281 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,339 software developers and data experts.

populate listbox value with field from dataset

Newbie to VB .NET.
My solution contains an item maintenance screen, one of the fields on the
screen is an item status, this field is defined as a listbox. The listbox
item property contains a collection of status values. If I later pull an
item record from the dataset into this item maintenance screen I cannot seem
to get the status value that is contained in the dataset to display on the
form, it displays the first value in the listbox item collection property.

Can anyone help me out with this?
Thanks.
Jul 21 '05 #1
2 5985
I wanted to add some more info, I am trying to populate the listbox in form1
via form2. The following code shows how I sucessfully populate all of the
other fields except the listbox. The listbox name is dblstStatus. I tried
several different things but none of them seem to work.

Public Sub dgdMinorMaterial1_DoubleClick(ByVal sender As Object, .........
Dim currRow As DataRow
Dim myColumn As DataColumn
Dim dataGridTable As DataTable
dataGridTable = CType(dgdMinorMaterial1.DataSource, DataTable)
currRow = dataGridTable.Rows(dgdMinorMaterial1.CurrentRowInd ex)
myColumn = dataGridTable.Columns(0)
f1.txtItemId.Text = currRow(myColumn,
DataRowVersion.Current).ToString()
myColumn = dataGridTable.Columns(1)
f1.txtItemDesc.Text = currRow(myColumn,
DataRowVersion.Current).ToString()
myColumn = dataGridTable.Columns(2)
f1.dblstStatus.Items.Contains(currRow(myColumn,
DataRowVersion.Current).ToString())
frmMinorMaterial.ActiveForm.Close()
End Sub
"Wishing I was skiing mom" wrote:
Newbie to VB .NET.
My solution contains an item maintenance screen, one of the fields on the
screen is an item status, this field is defined as a listbox. The listbox
item property contains a collection of status values. If I later pull an
item record from the dataset into this item maintenance screen I cannot seem
to get the status value that is contained in the dataset to display on the
form, it displays the first value in the listbox item collection property.

Can anyone help me out with this?
Thanks.

Jul 21 '05 #2
Changed the control to a combobox and it now is working in the manner that I
wanted it to.

"Wishing I was skiing mom" wrote:
Newbie to VB .NET.
My solution contains an item maintenance screen, one of the fields on the
screen is an item status, this field is defined as a listbox. The listbox
item property contains a collection of status values. If I later pull an
item record from the dataset into this item maintenance screen I cannot seem
to get the status value that is contained in the dataset to display on the
form, it displays the first value in the listbox item collection property.

Can anyone help me out with this?
Thanks.

Jul 21 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Stephen | last post: by
2 posts views Thread by James McGivney | last post: by
6 posts views Thread by Chris Leuty | last post: by
3 posts views Thread by Chris Kettenbach | last post: by
2 posts views Thread by Wishing I was skiing mom | last post: by
3 posts views Thread by Robert W. | last post: by
4 posts views Thread by Joe Blow | last post: by
reply views Thread by rosydwin | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.