473,407 Members | 2,315 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,407 software developers and data experts.

Changing ComboBox Data

I am working on an application as I try to learn/work with Visual
basic.
I am writing the application in Visual Studio 2005 and am connecting
the Application to an Access Database.
I used the Visual Studio wizard to create the data connection,
datasets etc.

I currently have a compbo box that is bound to "Product Description"
from the tblProducts in my database.
All appropriate textboxes on my main form are populated correctly
whenever the combo box loads or the option in the combo box is
changed.

Now I have 2 menu items, stemming from a "Select" option.
I have Select by Product ID and Select by Product Description.

I would like to choose either product ID , or Product Description and
have this choice change the information bound to my combo box. So
instead of displaying product description, it would now display
Product Id, and vice versa (depending on the Select choice).

I did not manually code the origional databind for the combo box,
however should I have to so that I can create these options I will.
Any advice is greatly appreciated.
Thank you.

Mar 25 '07 #1
1 1232
Take out the binding in design mode, and redo it in manual mode.

This one will show description, but selectedvalue will be ID. If you want
to show ID, change the DisplayMember to ProductID.

myComboBox.DataSource = myDataSet.ListByProductID
myComboBox.DisplayMember = "ProductDescription"
myComboBox.ValueMember = "ProductID"

or

This one will show and select description.

myComboBox.DataSource = myDataSet.ListByProductDescription
myComboBox.DisplayMember = "ProductDescription"
myComboBox.ValueMember = "ProductDescription"

See if that helps.

Robin S.
---------------------------------
"Schamness" <sc*******@gmail.comwrote in message
news:11**********************@l75g2000hse.googlegr oups.com...
>I am working on an application as I try to learn/work with Visual
basic.
I am writing the application in Visual Studio 2005 and am connecting
the Application to an Access Database.
I used the Visual Studio wizard to create the data connection,
datasets etc.

I currently have a compbo box that is bound to "Product Description"
from the tblProducts in my database.
All appropriate textboxes on my main form are populated correctly
whenever the combo box loads or the option in the combo box is
changed.

Now I have 2 menu items, stemming from a "Select" option.
I have Select by Product ID and Select by Product Description.

I would like to choose either product ID , or Product Description and
have this choice change the information bound to my combo box. So
instead of displaying product description, it would now display
Product Id, and vice versa (depending on the Select choice).

I did not manually code the origional databind for the combo box,
however should I have to so that I can create these options I will.
Any advice is greatly appreciated.
Thank you.

Mar 26 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: ColinWard | last post by:
Hi. I have a form which has as its recordsource an SQL string. The SQL String is as follows: SELECT * from CONTACTS where false. this ensures that there is no data loaded in the form when the...
7
by: Nicolae Fieraru | last post by:
Hi All, I am trying to change the rowsource of a combobox when I click on it. I played with many events, associated with the form and the combobox, but still haven't figured out what is the way...
1
by: Wavemaker | last post by:
I was wondering if there is a way to change the value of a control without triggering an event. The ComboBox control, for example, will trigger the SelectedIndexChanged event when its SelectedIndex...
2
by: John Smith | last post by:
Hey folks, I've got a combobox (DropDown List) in a windows form application which is bound to a DataSet. It's value is set to a numeric ID. It's visible text is set to a date. I need to make...
3
by: Doug | last post by:
Hi I have the following code (not mine) that populates a datagrid with some file names. But I want to replace the datagrid with a combo box. private void OnCurrentDataCellChanged(object sender,...
7
by: Sakharam Phapale | last post by:
Hi All, How to preserve the old font properties while changing new one? I posted same question 2 months back, but I had very small time then. eg. "Shopping for" is a text in RichTextBox and...
7
by: Simon Verona | last post by:
I posted this in dotnet.languages.vb.controls but thought I'd post here as well.. I have a combobox that is bound to a dataview generated from a dataset. The dataset has a single table...
6
by: dbuchanan | last post by:
VS2005 I've been reading all the help I can on the topic (MSDN, other) but I can't make sense of this. Desired behavior; The user is to choose from the displayed list of the databound combobox...
7
by: Arnold | last post by:
Greetings Gurus, In a mainform's header, I have a combobox named comboStudents. The rowsource for this combobox is: SELECT -999 As StudentID, "<Add New Student>" As FullName, "aaa" As...
7
oll3i
by: oll3i | last post by:
i want to change the values in two columns one colum is a combobox and the secons column is editable too i want to get the value of that second column and the value of combobox and sent that...
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
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.