Click here to Skip to main content
14,151,118 members
Rate this:
 
Please Sign up or sign in to vote.
See more:
I'm embarrassed to have to ask this question. It seems that I must be missing the most basic aspect of databinding (or at least the most basic aspect of looking something up with google), but I just can't figure this out without writing all sorts of event handlers and then manual binding controls to the data.

What I want is essentially a comboBox. That is, I want to have a ValueMember and a DisplayMember that hook up a master table with a selection from a related table based on an ID but displaying text. The problem with using a comboBox is that it is too simple and too small.

What I have is a contacts data table with many thousands of entries. I want the user to click on a button next to a textBox (much like you would with a comboBox) and get a list of these clients. However, because of its size, the list needs to be sortable, filterable, searchable, etc. So I have a form with a dataGridView and all the controls to do the above "find" of a contact.

It remains that when the user selects a contact, I need to store the contactDisplayName on the screen and the contactID in the master table. I'd really like to do this with databinding as opposed to writing my own.

I just can't believe I'm asking this question!
Posted
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

I dont know if Extending the DataGridView[^] might give you some ideas.
   
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 2

Thanks, but no that didn't help.

To restate the problem in simpler terms, what I need is a "textBox" that supports complex binding so that I can bind it to an ID field in a master table but have a text field displayed in the control from a related child. Exactly like a comboBox but with my own custom drop-down list. That's all.

It has nothing to do with datagridview, really.
   
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 3

Brice,

I'm no expert but I think the way to do this is with value converters.

Cheers,
Charlie
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Cookies | Terms of Service
Web04 | 2.8.190518.1 | Last Updated 15 Feb 2011
Copyright © CodeProject, 1999-2019
All Rights Reserved.
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100