Click here to Skip to main content
15,912,504 members
Home / Discussions / Visual Basic
   

Visual Basic

 
AnswerRe: small arrow at my form Pin
Dave Kreskowiak6-May-08 7:55
mveDave Kreskowiak6-May-08 7:55 
GeneralRe: small arrow at my form Pin
asha_s6-May-08 8:34
asha_s6-May-08 8:34 
GeneralRe: small arrow at my form Pin
Dave Kreskowiak6-May-08 8:44
mveDave Kreskowiak6-May-08 8:44 
QuestionRe: small arrow at my form Pin
asha_s6-May-08 8:54
asha_s6-May-08 8:54 
AnswerRe: small arrow at my form Pin
Dave Kreskowiak6-May-08 9:03
mveDave Kreskowiak6-May-08 9:03 
GeneralRe: small arrow at my form Pin
asha_s7-May-08 3:03
asha_s7-May-08 3:03 
QuestionDataGridViewComboBoxColumn doesn't show data until clicked in a datagridview control Pin
SteveNY6-May-08 6:08
SteveNY6-May-08 6:08 
AnswerRe: DataGridViewComboBoxColumn doesn't show data until clicked in a datagridview control Pin
Dave Kreskowiak6-May-08 8:13
mveDave Kreskowiak6-May-08 8:13 
It's strange that you're using a Combo to show/pick the price of a product.

Normally, a combo is used to pick from a standard list of items where the ID of an item in the list corresponds to an ID column in another table. For example, a list of team IDs and Names in one table and a schedule table, listing two teams ID's, instead of names. The combo would show you the team names (DisplayMember), but the value (ValueMember) of each name in the list returns that teams ID. This ID would be populated into the schedule table (DataPropertyName).

For this to work you need two binding sources. One bound to the schedule data and one bound to the team data. For example, there are two BindingSources, one called MasterScheduleBindingSource, which the DataGridView is bound to is bound to a table containing the data for the schedule, and a second TeamsDataBindingSource, which will be used by the combo and is bound to a table with TeamId's and names.
Dim comboColumn As New DataGridViewComboBoxColumn
With comboColumn
    ' Column header that shows up in the DataGridView
    .HeaderText = "Home Team"
 
    ' This is the column name in the MasterScheduleBindingSource where team ID's are going to get stored.
    .DataPropertyName = "HomeTeamId"
 
    ' This is the binding for the combo to it's data
    .DataSource = TeamsDataBindingSource
    .ValueMember = "TeamID"
    .DisplayMember = "TeamName"
End With
MyDGV.Columns.Add(comboColumn)



A guide to posting questions on CodeProject[^]



Dave Kreskowiak
Microsoft MVP
Visual Developer - Visual Basic
     2006, 2007, 2008




GeneralRe: DataGridViewComboBoxColumn doesn't show data until clicked in a datagridview control Pin
SteveNY6-May-08 8:22
SteveNY6-May-08 8:22 
GeneralRe: DataGridViewComboBoxColumn doesn't show data until clicked in a datagridview control Pin
Dave Kreskowiak6-May-08 8:46
mveDave Kreskowiak6-May-08 8:46 
GeneralRe: DataGridViewComboBoxColumn doesn't show data until clicked in a datagridview control Pin
SteveNY6-May-08 11:13
SteveNY6-May-08 11:13 
GeneralRe: DataGridViewComboBoxColumn doesn't show data until clicked in a datagridview control Pin
Dave Kreskowiak6-May-08 19:23
mveDave Kreskowiak6-May-08 19:23 
GeneralRe: DataGridViewComboBoxColumn doesn't show data until clicked in a datagridview control Pin
SteveNY7-May-08 11:12
SteveNY7-May-08 11:12 
GeneralRe: DataGridViewComboBoxColumn doesn't show data until clicked in a datagridview control Pin
Dave Kreskowiak7-May-08 14:05
mveDave Kreskowiak7-May-08 14:05 
GeneralRe: DataGridViewComboBoxColumn doesn't show data until clicked in a datagridview control Pin
SteveNY8-May-08 11:23
SteveNY8-May-08 11:23 
GeneralRe: DataGridViewComboBoxColumn doesn't show data until clicked in a datagridview control Pin
Dave Kreskowiak8-May-08 13:29
mveDave Kreskowiak8-May-08 13:29 
AnswerRe: DataGridViewComboBoxColumn doesn't show data until clicked in a datagridview control Pin
javedk096-May-08 19:56
javedk096-May-08 19:56 
QuestionOPEN A NON ACTIVE FORM Pin
robby19776-May-08 4:03
robby19776-May-08 4:03 
AnswerRe: OPEN A NON ACTIVE FORM Pin
Dave Kreskowiak6-May-08 4:54
mveDave Kreskowiak6-May-08 4:54 
GeneralRe: OPEN A NON ACTIVE FORM Pin
robby19777-May-08 11:39
robby19777-May-08 11:39 
Question[Message Deleted] Pin
nishkarsh_k6-May-08 3:30
nishkarsh_k6-May-08 3:30 
AnswerRe: Error while saving image to file "A generic error occurred in GDI+." Pin
Dave Kreskowiak6-May-08 3:48
mveDave Kreskowiak6-May-08 3:48 
GeneralRe: Error while saving image to file "A generic error occurred in GDI+." Pin
nishkarsh_k6-May-08 4:02
nishkarsh_k6-May-08 4:02 
GeneralRe: Error while saving image to file "A generic error occurred in GDI+." Pin
Dave Kreskowiak6-May-08 4:33
mveDave Kreskowiak6-May-08 4:33 
GeneralRe: Error while saving image to file "A generic error occurred in GDI+." Pin
nishkarsh_k6-May-08 9:36
nishkarsh_k6-May-08 9:36 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.