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 / .NET Framework / New Users / January 2006

Tip: Looking for answers? Try searching our database.

DataGridView DataGridViewComboBoxColumn

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Nathan Franklin - 20 Jan 2006 04:10 GMT
Hey List,

I am trying display a combobox in place of one of my columns in my
DataGridView.
I create the combo box column and assign the
DataGridViewComboBoxColumn.datasource to a datasource to load in value for
my combo box. The fields I use are ID and Description.
I have set the DisplayMember to Description and the ValueMember to ID, but
after the values are loaded in and i set the data source of the dataviewgrid
my combobox column displays the value that has come from the DataSource of
the DataViewGrid.

How can I display to DisplayMember to screen after data has been loaded?

Here is my code below..

' create FieldType column
Dim cmbColFieldType As New DataGridViewComboBoxColumn
cmbColFieldType.DropDownWidth = 160
cmbColFieldType.MaxDropDownItems = 3
cmbColFieldType.FlatStyle = FlatStyle.Flat
cmbColFieldType.DataSource = InteriorSetupTables.Tables("FieldTypes") '
contains values ID and Description
cmbColFieldType.DataPropertyName = "FieldType"
cmbColFieldType.DisplayMember = "Description" ' is a String Value
cmbColFieldType.ValueMember = "ID" ' ID is an INT value
cmbColFieldType.HeaderText = "Field Type"
cmbColFieldType.Name = "FieldType"
cmbColFieldType.ValueType = GetType(System.Int32)
dgExtendedDataSets.Columns.Add(cmbColFieldType)

' SET THE DATASOURCE FOR THIS GRID
dgExtendedDataSets.AutoGenerateColumns = False
dgExtendedDataSets.DataSource = ExTable ' exTable contains columns including
FieldType which is an int value

Thanks very much!
Nathan
Nathan Franklin - 20 Jan 2006 04:13 GMT
I should add..

The combobox values are listed in the combobox ok, but it just isnt updating
the datagridview's screen

> Hey List,
>
[quoted text clipped - 34 lines]
> Thanks very much!
> Nathan

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.