473,382 Members | 1,480 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

with DataGrid, Used tablestyle and Grid Column Style

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.
Nov 21 '05 #1
3 1796
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.

Nov 21 '05 #2
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.


Nov 21 '05 #3
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.


Nov 21 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Marty | last post by:
Hi, How do I set rows/colums, titles and data in the DataGrid control of VB.NET. I don't want to pass through a dataset and use databinding. I want to set this grid manually. Is there any...
2
by: Peter | last post by:
I have a DataGrid control on a form and I used the Auto Format feature to format the grid. The problem is now if I resize a column in my code I loose some of the formats - some of the grid colors...
0
by: Patrick | last post by:
I'm working on a contact management application, and need a hand with one aspect... Here's what I want to create: ------------------------------------ A form split into two parts. There is a...
2
by: Angel | last post by:
The Winform datagrid I'm working is already displaying data from a datatable. How can I add columns to that datagrid? I know (or at least I think I know) how to add the tableStyle and...
1
by: nevin | last post by:
Hiya, I have a table which without any tablestyles and associated columns displays all the columns of the table as you would expect. If I add a tablestyle and one column which I then add the...
14
by: Brett Sinclair | last post by:
Hello everybody I'm still on the learning curve here...and from what I read, I created inherited datagrid class so I could have icons, combobox...etc in the columns of my datagrid. The grid...
2
by: Ron L | last post by:
I am attempting to set up a datagrid that will 1) display a subset of data from a SQL Stored Procedure in a different order form how SQL returns it, and 2) display 3 of the columns using pulldowns....
8
by: Scott Meddows | last post by:
I have a datagrid control that I've inherited from the base datagrid control (Source below). I am applying a datatable style onto the datatable that I assign as my datasource. All of my column...
4
by: Rich | last post by:
Hello, I have a one datagrid that will be based on different datatables. One datatable may have 7 columns, another 15... With the tables that have more columns, I have been manually dragging...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.