473,394 Members | 1,481 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 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 6094
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Stephen | last post by:
Was wondering if it is possible to take the contents of a row in a datagrid and use an event to copy over the details of the selected row into another datagrid. I'd like to be able to do the...
2
by: James McGivney | last post by:
In a C# program I have an SQL database. A data adapter is connected to the database and a dataset has been generated. I would like to populate a listBox (or comboBox) from the dataset such that...
6
by: Chris Leuty | last post by:
I am populating a multiselect Listbox from a dataset, with the content of the listbox filled by one table, and the selections determined from another table. So far, I have been keeping the dataset...
4
by: dtblankenship | last post by:
Hello everyone, I know this question has been asked many times in the forums, and after spending a few days reading, I am still confused as to the answer. I have a ListBox (lstBox),...
3
by: Chris Kettenbach | last post by:
Hello all, Quick question. I have a listbox that is populated by items from a database. When the user select something from the list, I want to populate another listbox based on the selection in...
5
by: Dave | last post by:
Hi All, I have a windows form that contains 2 listboxes and 2 buttons. The listbox on the right is populated by a database routine (This is the easy part). The listbox on the left is populated...
2
by: Wishing I was skiing mom | last post by:
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...
3
by: Robert W. | last post by:
I have a SQL Server table called "ClosedMonths" that contains two pertinent fields: Yearx Monthx 2000 1 2000 2 2000 3 I want to simply query this...
4
by: Joe Blow | last post by:
Folks, I have read all the posts about databases I could find and I think I need a little more help. I want to take all the items from a field in an access database and use them as list items in...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

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.