You want some code something like:
==========
Private Sub AddTableStyle()
Dim ts1 As New DataGridTableStyle
ts1.MappingName = "table name"
ts1.AlternatingBackColor = Color.LightBlue
Dim TextCol_0 As New DataGridTextBoxColumn
TextCol_0.MappingName = "field name"
TextCol_0.HeaderText = "column header in gridBase Code"
TextCol_0.Width = 160
TextCol_0.TextBox.MaxLength = 12
ts1.GridColumnStyles.Add(TextCol_0)
' Add a second column style.
Dim TextCol_1 As New DataGridBoolColumn
TextCol_1.MappingName = "Membrane"
TextCol_1.HeaderText = "Membrane"
TextCol_1.Width = 90
TextCol_1.AllowNull = False
TextCol_1.FalseValue = "N"
TextCol_1.TrueValue = "Y"
ts1.GridColumnStyles.Add(TextCol_1)
Me.grdwhatever.TableStyles.Add(ts1)
End Sub
--
Regards,
Andy O'Neill
"Reza G." <Re***@discussions.microsoft.com> wrote in message
news:55**********************************@microsof t.com...
Chris,
I am using the DataGrid property to create one Tablestyle and within the
DataStyles Collections, I have used the GridColumnStyles to create the 4
members for the for columns. For each column, in the MappingName field I
selected the desired column Name.
"Chris, Master of All Things Insignifican" wrote:
Do you add the GridColumnStyle to the TableStyle? I don't remember the
name
of the collection that you add them to, but they are what determine how
many
columns/what are shown. Can you post your code so we can see what your
doing?
Chris
"Reza G." <Reza G.@discussions.microsoft.com> wrote in message
news:3C**********************************@microsof t.com... >I am creating a window forms, and placed a datagrid on it.
> Set the DataSource and DataMember, and I get all the column in the
> table
> (relation) shown. I used TableStyles of the DataGrid and add a new
> member.
> I set its MappingName same as DataMember. Then I use GridColumnStyle
> and
> add the columns I needed. But when I run the application all the
> column
> in
> the tables are shown and it seems that th GridColumnstyles is totally
> ignored.