One Data Source to Show, One to Pick from in a Combo Box in VB?

P

PatrickA

All,

I have a DataGridView I am creating/filling at runtime from the Data
Source "Widgets."

I am able to add a DataGridViewComboBoxColumn (named ColColor) to that
DataGridView.

When you pull down the drop-down in ColColor, it displays the values
from another Data Source, "Colors."

Is it possible for me to connect ColColor to the Data Source "Widgets"
so that if a color value is already set for a row in that data source,
it shows up in the ColColor when the form loads?

If so, how? Is it in the .DataPropertyName? If so, can anyone help
me with the the syntax?

Here's what I have so far...besides a headache.

With Me.DataGridView1
With ColumnColor
.DataSource = dtCol ' Data source that populates
the selections
.DisplayMember = "Color" 'retrieve values to
display in combo boxes
.ValueMember = "Color" 'column from which to get
values that correspond to what is chosen
.HeaderText = "Color" ' header text
.DataPropertyName = 'gets/sets name of data source
property or db column to which the DGVC is bound.
End With
.Columns.Add(ColumnColor)
End With
 
P

PatrickA

By the way, I also have a column that is bringing in the color from
the Data Source "Widgets" and displaying it in a "text" field...if
there's an easy way to make that column a DataGridViewComboBoxColumn,
I'm up for that as well.

Thanks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top