By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,533 Members | 2,102 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,533 IT Pros & Developers. It's quick & easy.

populate listbox value with field from dataset

P: n/a
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
Share this Question
Share on Google+
2 Replies


P: n/a
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

P: n/a
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.