The most important difference in what I was doing was that I was tying the grid to an object. There is a very good sample of this in the MappingName help topic. The operative element is that you set the MappingName to the Class type which seems sort of counterintuitive. In the sample it was ArrayList.
Thanks again
Mike
>Thanks Kevin
>
>That may help. It is at least a very straight forward example.
>Thanks
>(wordcount=15) :)
>>Michael,
>>
>>Jeez...and I thought I was the wordiest guy on the planet!
>>
>>I may be mis-reading your question, and if I have, I apologize, but here's a very simple code sample for customizing the display of a grid for specific # of columns.
>>
>>This is based on a datatable, so I don't know if it applies to what you're doing, but here it is...
>>
>>dataGridEmployees.DataSource = DsEmployeeHeaders.Tables[0];
>>
>>DataGridTableStyle style = new DataGridTableStyle();
>>style.MappingName = "EmployeeResults";
>>
>>DataGridTextBoxColumn fld1 = new DataGridTextBoxColumn();
>>fld1.Alignment = HorizontalAlignment.Left;
>>fld1.HeaderText = "First Name";
>>fld1.MappingName = "FirstName";
>>fld1.ReadOnly = true;
>>fld1.Width = 85;
>>
>>DataGridTextBoxColumn fld2 = new DataGridTextBoxColumn();
>>fld2.Alignment = HorizontalAlignment.Left;
>>fld2.HeaderText = "Last Name";
>>fld2.MappingName = "lastname";
>>fld2.ReadOnly = true;
>>fld2.Width = 85;
>>
>>DataGridTextBoxColumn fld3 = new DataGridTextBoxColumn();
>>fld3.Alignment = HorizontalAlignment.Left;
>>fld3.HeaderText = "Address";
>>fld3.MappingName = "Address1";
>>fld3.ReadOnly = true;
>>fld3.Width = 180;
>>
>>style.GridColumnStyles.AddRange(new DataGridColumnStyle[] {fld1, fld2, fld3});
>>style.PreferredRowHeight = 20;
>>style.BackColor = Color.FromArgb(255,255,255);
>>style.AlternatingBackColor = Color.FromArgb(234,239,251);
>>style.SelectionBackColor = Color.FromArgb(118, 149, 222);
>>dataGridEmployees.TableStyles.Clear();
>>dataGridEmployees.TableStyles.Add(style);
>>
>>dataGridEmployees.DataSource = DsEmployeeHeaders.Tables[0];
>>DsEmployeeHeaders.Tables[0].DefaultView.AllowNew = false;
>>
>>Does that help?
>>
>>Kevin
Précédent
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement