1. Wrong table mapping name - for DataTable should be table name, for pretty
much everything else should be empty string.
2. Wrong column mapping name - no column called "ID"

Signature
Best regards,
Ilya
This posting is provided "AS IS" with no warranties, and confers no rights.
*** Want to find answers instantly? Here's how... ***
1. Go to
http://groups-beta.google.com/group/microsoft.public.dotnet.framework.compactfra
mework?hl=en
2. Type your question in the text box near "Search this group" button.
3. Hit "Search this group" button.
4. Read answer(s).
> Hi,
> I can't make this style visible. I'm new in coding but I readed every
[quoted text clipped - 13 lines]
>
> Any idea what is wrong?
a
dataGrid1.TableStyles.Clear();
is missing before
dataGrid1.TableStyles.Add(myGridStyle);
Ruediger
lodzik - 18 Dec 2006 23:20 GMT
I doesn't work, ID column exist.
Rüdiger Kardel - 18 Dec 2006 23:55 GMT
is there a
dataGrid1.DataSource = aDataTableOrSth
missing?
last but not least:
if you are using a datatable as datasource: the mappingname is
casesensitive.
if it didn't work either:
show us some more code, please.
Ruediger
>I doesn't work, ID column exist.
lodzik - 19 Dec 2006 14:46 GMT
I have a variable file which is collection of objects (my own class
Line). In Form_Load event I have the following code:
DataGridTableStyle myGridStyle = new DataGridTableStyle();
myGridStyle.MappingName = "";
DataGridTextBoxColumn idColumn = new DataGridTextBoxColumn();
idColumn.MappingName = "ID";
idColumn.HeaderText = "Test";
idColumn.Width = 240;
myGridStyle.GridColumnStyles.Add(idColumn);
dataGrid1.TableStyles.Add(myGridStyle);
lineBindingSource.DataSource = file;
I have:
public class Line
{
/* some stuff */
public int ID
{
get { return id; }
set { id = value; }
}
}
class File : IEnumerable
{
/* some stuff */
List<Line> lines = new List<Line>();
#region IEnumerable Members
public IEnumerator GetEnumerator()
{
return lines.GetEnumerator();
}
#endregion
}
DataGrid1 contains all data, but I couldn't set the column width.
JP - 27 Dec 2006 02:25 GMT
Hello,
I thinks, this operation have work with the dataset.
regards
> I have a variable file which is collection of objects (my own class
> Line). In Form_Load event I have the following code:
[quoted text clipped - 45 lines]
>
> DataGrid1 contains all data, but I couldn't set the column width.