Click here to Skip to main content
15,927,694 members
Home / Discussions / C#
   

C#

 
GeneralRe: Automatic printing to pdf Pin
Heath Stewart21-Oct-04 6:23
protectorHeath Stewart21-Oct-04 6:23 
GeneralRe: Automatic printing to pdf Pin
sverre.andersen4-Nov-04 0:06
sverre.andersen4-Nov-04 0:06 
GeneralRe: Automatic printing to pdf Pin
Heath Stewart4-Nov-04 4:55
protectorHeath Stewart4-Nov-04 4:55 
GeneralComboboxes with relations in a datagrid Pin
jalla7214-Oct-04 0:44
jalla7214-Oct-04 0:44 
GeneralRe: Comboboxes with relations in a datagrid Pin
Heath Stewart14-Oct-04 6:46
protectorHeath Stewart14-Oct-04 6:46 
GeneralRe: Comboboxes with relations in a datagrid Pin
jalla7214-Oct-04 20:04
jalla7214-Oct-04 20:04 
GeneralRe: Comboboxes with relations in a datagrid Pin
Heath Stewart14-Oct-04 20:14
protectorHeath Stewart14-Oct-04 20:14 
GeneralRe: Comboboxes with relations in a datagrid Pin
jalla7215-Oct-04 0:01
jalla7215-Oct-04 0:01 
Ok. Good to hear. If we go back to my problem, I try to make combobox columns in my datagrid with code like this:

case 4:
ComboTextColvk = new DataGridComboBoxColumn();
ComboTextColvk.MappingName = "VareKategori"; //must be from the grid table...
ComboTextColvk.HeaderText = "VareKategori";
ComboTextColvk.Width = 120;
ComboTextColvk.ColumnComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
ComboTextColvk.ColumnComboBox.DataSource = relationDG1.Tables["UnderGruppe"].DefaultView;
ComboTextColvk.ColumnComboBox.DisplayMember = "UHR.VHR.Beskrivelse";
ComboTextColvk.ColumnComboBox.ValueMember = "UHR.VHR.VareKategoriId";//use for string value in combo
tableStyle.PreferredRowHeight = ComboTextColvk.ColumnComboBox.Height + 2;
ComboTextColvk.ColumnComboBox.Enabled = false;
tableStyle.GridColumnStyles.Add(ComboTextColvk);
break;

case 5:
ComboTextColhg = new DataGridComboBoxColumn();
ComboTextColhg.MappingName = "HovedGruppe"; //must be from the grid table...
ComboTextColhg.HeaderText = "HovedGruppe";
ComboTextColhg.Width = 120;
ComboTextColhg.ColumnComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
ComboTextColhg.ColumnComboBox.DataSource = relationDG1.Tables["UnderGruppe"].DefaultView;
ComboTextColhg.ColumnComboBox.DisplayMember = "UHR.Beskrivelse";
ComboTextColhg.ColumnComboBox.ValueMember = "UHR.HovedGruppeId";
ComboTextColhg.ColumnComboBox.Enabled = false;
tableStyle.PreferredRowHeight = ComboTextColhg.ColumnComboBox.Height + 2;
tableStyle.GridColumnStyles.Add(ComboTextColhg);
break;

case 6:
ComboTextColug = new DataGridComboBoxColumn();
ComboTextColug.MappingName = "UnderGruppe"; //must be from the grid table...
ComboTextColug.HeaderText = "UnderGruppe";
ComboTextColug.Width = 120;
ComboTextColug.ColumnComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
ComboTextColug.ColumnComboBox.DataSource = relationDG1.Tables["UnderGruppe"].DefaultView;
ComboTextColug.ColumnComboBox.DisplayMember = "Beskrivelse";
ComboTextColug.ColumnComboBox.ValueMember = "UnderGruppeId";
tableStyle.PreferredRowHeight = ComboTextColug.ColumnComboBox.Height + 2;
tableStyle.GridColumnStyles.Add(ComboTextColug);
break;


The relationDG1 dataset contains three tables UnderGruppe, HovedGruppe and VareKategori, I have made a Relation between the tabels.
One between UnderGruppe and HovedGruppe called UHR (have HovedGruppeId in both tables UnderGruppe and HovedGruppe), and another between HovedGruppe and VareKategori called VHR (have VareKategoriID in both tables HovedGruppe and Varekategori).

I'm doing this because I want that the user only shall select a UnderGruppe, then the values from HovedGruppe and VareKategori will be auto selected. All the values shall be saved in a fourth table called Vare.

I have tried the relation with three ComboBoxes in a windows form, and it works fine, but I get errors when I try to the same in a DataGrid, I get messages like this: UHR.Beskrivelse is not a column in table undergruppe and neither a relation.

Is there anyway I can get this to work in a Datagrid??
GeneralRe: Comboboxes with relations in a datagrid Pin
Heath Stewart15-Oct-04 6:18
protectorHeath Stewart15-Oct-04 6:18 
QuestionHow to make the Form (at run time) behave like the Form (at design time) Pin
god4k14-Oct-04 0:33
god4k14-Oct-04 0:33 
AnswerRe: How to make the Form (at run time) behave like the Form (at design time) Pin
Heath Stewart14-Oct-04 6:50
protectorHeath Stewart14-Oct-04 6:50 
AnswerRe: How to make the Form (at run time) behave like the Form (at design time) Pin
Christian Wikander15-Oct-04 3:32
Christian Wikander15-Oct-04 3:32 
GeneralMoving a file over a network. Pin
Dylan van Heerden14-Oct-04 0:30
Dylan van Heerden14-Oct-04 0:30 
GeneralRe: Moving a file over a network. Pin
Colin Angus Mackay14-Oct-04 2:00
Colin Angus Mackay14-Oct-04 2:00 
GeneralRe: Moving a file over a network. Pin
Dylan van Heerden14-Oct-04 2:18
Dylan van Heerden14-Oct-04 2:18 
GeneralRe: Moving a file over a network. Pin
Colin Angus Mackay14-Oct-04 2:22
Colin Angus Mackay14-Oct-04 2:22 
GeneralRe: Moving a file over a network. Pin
Dylan van Heerden14-Oct-04 2:39
Dylan van Heerden14-Oct-04 2:39 
GeneralRe: Moving a file over a network. Pin
Colin Angus Mackay14-Oct-04 2:47
Colin Angus Mackay14-Oct-04 2:47 
GeneralRe: Moving a file over a network. Pin
Dylan van Heerden14-Oct-04 2:51
Dylan van Heerden14-Oct-04 2:51 
GeneralRe: Moving a file over a network. Pin
Heath Stewart14-Oct-04 6:43
protectorHeath Stewart14-Oct-04 6:43 
GeneralRe: Moving a file over a network. Pin
Heath Stewart14-Oct-04 6:38
protectorHeath Stewart14-Oct-04 6:38 
GeneralStrong name to Interop assembly Pin
hatim_ali13-Oct-04 23:44
hatim_ali13-Oct-04 23:44 
GeneralRe: Strong name to Interop assembly Pin
Alex Korchemniy14-Oct-04 9:18
Alex Korchemniy14-Oct-04 9:18 
GeneralRe: Strong name to Interop assembly Pin
hatim_ali14-Oct-04 19:19
hatim_ali14-Oct-04 19:19 
GeneralInsert RTF files in Access DB Pin
Zamolxes13-Oct-04 23:35
Zamolxes13-Oct-04 23:35 

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.