Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / WinForm Data Binding / February 2006

Tip: Looking for answers? Try searching our database.

Selectively populating ComboBoxColumns in a DataGridView

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Kjell - 14 Feb 2006 12:34 GMT
I'm trying to use a DataGridView to list a number of artifacts from a
DataTable. As there can be duplicate instances of one artifact stored on the
disk there is also a related "Source" DataTable that holds the file paths to
each instance of an artifact. Now I want to include a ComboBoxColumn in my
DataGridView of artifacts to choose one particular inctance for each artifact
to be my master instance.

The problem now is that each ComboBoxColumn schould be populated with just
the instances related to the particular artifact described on that row, not
with the entire "Source" table.

I have bound a DataView of the "Source" DataTable to the ComboBoxColumn
allright, but I have failed to find any useful event to let me set the
RowFilter when a particular ComboBoxCell is about to be populated. It looks
like all visible ComboBoxCells are repopulated each time a row is entered or
edited.

Can this be done, or are there other techniques to achive the result I'm
looking for.
Bart Mermuys - 14 Feb 2006 12:54 GMT
Hi,

> I'm trying to use a DataGridView to list a number of artifacts from a
> DataTable. As there can be duplicate instances of one artifact stored on
[quoted text clipped - 18 lines]
> or
> edited.

The basic idea is to have two BindingSource's (linked to the same lookup
table).  One is filtered on the fly, the other one is always unfiltered.

When DataGridView.CellBeginEdit is fired, you (re)filter the filtered
BindingSource and assign it to ComboBoxCell.DataSource.

When DataGridView.CellEndEdit is fired, you assign the unfiltered
BindingSource back to the ComboBoxCell.DataSource.

Have a look at the thread in this newsgroup from a week ago:
http://tinyurl.com/94osm

And this one:
http://tinyurl.com/77rlp

HTH,
Greetings

> Can this be done, or are there other techniques to achive the result I'm
> looking for.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.