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

Custom displaymember in comboBox

How can I have the comboBox display valuemember in addition to the column
specified in displaymember?
For example, I want to display stationID 1999 (valuemember) and stationName
such as "1999 - Station 1999" .

Any help is greatly appreciated.

Thanks

Bill
Dec 6 '05 #1
6 1939
Bill,

I never used it, however those who did where very glad with it.

http://www.planet-source-code.com/vb...2934&lngWId=10

I hope this help,

Cor
Dec 7 '05 #2
hi Bill,
if you are fetching data from the database then u can do it in
Query itself. try this: "select ValueMember + ' - ' + displayMember as
DisMember,ValueMember from TableX"

Dec 7 '05 #3
Lucky,

No that is not the way, you can add an extra column in the datatable with an
expression, however most don't like that way.

Cor
"Lucky" <tu************@gmail.com> schreef in bericht
news:11**********************@g14g2000cwa.googlegr oups.com...
hi Bill,
if you are fetching data from the database then u can do it in
Query itself. try this: "select ValueMember + ' - ' + displayMember as
DisMember,ValueMember from TableX"

Dec 7 '05 #4
hi Cor,
of course people wont go that way. do u know how much it costs to add
one column in the DB Table? and whats ths worng in using this Query.
can u tell me the flaws in this Query. coz i've done this in my project
and it is working fine. why not to get most out of the SQL when it is
providing.
i definatly would like to have your views on this dude.

Dec 8 '05 #5
Lucky,
of course people wont go that way. do u know how much it costs to add
one column in the DB Table? and whats ths worng in using this Query.
can u tell me the flaws in this Query. coz i've done this in my project
and it is working fine. why not to get most out of the SQL when it is
providing.
i definatly would like to have your views on this dude.


It cost this statemement

dt.columns.add("MyDisplayValue",Gettype(System.Str ing),"First + Second")

Cor
Dec 8 '05 #6
I'm using Lucky's tip now since I need to get it done quickly but I would
like to use Cor's later on.
Thank you both!

Bill

"Cor Ligthert [MVP]" <no************@planet.nl> wrote in message
news:Os****************@TK2MSFTNGP11.phx.gbl...
Lucky,
of course people wont go that way. do u know how much it costs to add
one column in the DB Table? and whats ths worng in using this Query.
can u tell me the flaws in this Query. coz i've done this in my project
and it is working fine. why not to get most out of the SQL when it is
providing.
i definatly would like to have your views on this dude.


It cost this statemement

dt.columns.add("MyDisplayValue",Gettype(System.Str ing),"First + Second")

Cor

Dec 16 '05 #7

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

Similar topics

3
by: Alex Stevens | last post by:
I'd already posted this in microsoft.public.dotnet.framework.windowsforms and microsoft.public.dotnet.framework.windowsforms.controls to no avail so apologies for the cross-posting. Hi, I'm...
3
by: Bill C. | last post by:
Hello, I know this has been discussed a lot already because I've been searching around for information the last few weeks. I'm trying to implement a DataGridComboBoxColumn class. I've found...
1
by: TT (Tom Tempelaere) | last post by:
Hi there, I made a custom drawn ComboBox. The DrawItem event handler is (explanation follows) <code> private void OnDrawItem ( object sender, System.Windows.Forms.DrawItemEventArgs e ) {
1
by: Bruce | last post by:
Hi, there, I meet a problem about comboBox binding. -------------------- Database: Northwind Tables: 1) Products 2) Categories I create a form (named "form1") to edit the record from...
3
by: Bob | last post by:
Thinking two things, 1- Creating a userControl -yeah you guessed it, a multi column drop down combobox - I've looked at several articles and did not find what I need, one that's bindable and that...
8
by: mongphong28 | last post by:
Hi, I'm populating a ComboBox with objects which contain two properties - IntegerValue and StringValue. I display StringValue in the ComboBox form and can retrieve IntegerValue from the...
3
by: Richard Ryerson | last post by:
I have a general DataGridComboBoxColumn that I built using the Example in the .NET 2003 Combined Collection help file (that was a data time picker). I am able to assign a data source and display...
0
by: Dundealing | last post by:
Hi, I have the following code to set the DataSource of a ComboBox to a certain table in an untyped DataSet, and I also want to set the DisplayMamaber of the ComboBox to a certain column: ...
6
by: =?Utf-8?B?UmljaGFyZCBCeXNvdXRo?= | last post by:
Hi I'm having problems getting the correct item to display in a bound combobox in my WinForms app. Using the following code: With Me.MyComboBox .ValueMember = "MyIdField" .DisplayMember =...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.