Hi all,
I have a question about my c# windows application.
I have 2 datatables:
- myUserDataTable
- myCountriesDataTable
Now I want to add a textboxcolumn in my datagridview.
In myUserDataTable there is a column with prefix of countrynames. f.e. GB / NL / USA etc.
In myCountriesDataTable I have 2 columns. 1 columns with the prefixxes, and one with the full name of the country.
Now I want to display the fullnames of the country in my textbox.
F.e:
User 1 has preferred team : GB.
Now I must do a search or a relationship must be created to look up the full name of that country
Can somebody help?
Bas van BerkelPosted May 20, 2008, 9:47 AM
Solved it already.
Didn't do it with a textboxcolumn, but with a comboboxcolumn:
DataGridViewComboBoxColumn countryComboBoxColumn = new DataGridViewComboBoxColumn();
countryComboBoxColumn.DataSource = myCountryDataTable;
countryComboBoxColumn.DisplayMember = myCountryDataTable.CountryNameColumn.ColumnName;
countryComboBoxColumn.ValueMember = myCountryDataTable.CountryCodeColumn.ColumnName;
countryComboBoxColumn.DataPropertyName = myUserDataTable.CountryCodeColumn.ColumnName;
countryComboBoxColumn.HeaderText = myCountryDataTable.CountryNameColumn.ColumnName;
countryComboBoxColumn.Name = myCountryDataTable.CountryNameColumn.ColumnName;
countryComboBoxColumn.DisplayStyle =
DataGridViewComboBoxDisplayStyle.Nothing;perfectly :-)