populate listbox value with field from dataset

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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.
 
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.CurrentRowIndex)
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
 
Changed the control to a combobox and it now is working in the manner that I
wanted it to.
 
Back
Top