473,387 Members | 1,553 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,387 software developers and data experts.

Changing DataGrid Column headings

I am attempting to change the header text on all the columns in my datagrid
once it was been populated from a dataset. I have tried to implement some
code from the following MSDN document but what I get is all my columns
having the same values and header text as the last column I added to
DataGridTableStyle I was creating.

Can anyone assist?

Here is the link:
http://msdn.microsoft.com/vbasic/usi.../default.aspx?
pull=/library/en-us/dnwinforms/html/wnf_CustDataGrid.asp
regards,

Mac

--
Message posted via DotNetMonster.com
http://www.dotnetmonster.com/Uwe/For...b-net/200505/1
Nov 21 '05 #1
4 1239
Hi,

If the mappingname for the tablestyle is wrong the tablestyle will have
no effect. Try using the dataset.table(0).tablename for the tablestyles
mapping name

Ken
-------------------

"Mac via DotNetMonster.com" wrote:
I am attempting to change the header text on all the columns in my datagrid
once it was been populated from a dataset. I have tried to implement some
code from the following MSDN document but what I get is all my columns
having the same values and header text as the last column I added to
DataGridTableStyle I was creating.

Can anyone assist?

Here is the link:
http://msdn.microsoft.com/vbasic/usi.../default.aspx?
pull=/library/en-us/dnwinforms/html/wnf_CustDataGrid.asp
regards,

Mac

--
Message posted via DotNetMonster.com
http://www.dotnetmonster.com/Uwe/For...b-net/200505/1

Nov 21 '05 #2
Thanks for replying Ken.
I currently have tablestyle.mappingname = "Policies" and the name of the
datatable bound to the datagrid is the same name.

Is this correct?

--
Message posted via http://www.dotnetmonster.com
Nov 21 '05 #3
Don't bother - I got it working. Looks like the code was incorrect.

Each column I was adding to the tablestyle used the same variable, which is
obviously why when it came time to update the datagrid with the style it
used the last update value, which was the last column.

To resolve I created a separate variable for each column and that did the
trick!

--
Message posted via DotNetMonster.com
http://www.dotnetmonster.com/Uwe/For...b-net/200505/1
Nov 21 '05 #4
Mac,

It is a standard problem. You did probably not create every column as a
"New" column and now you did that automatic with giving them all another
name.

To give you an answer on the "why".

I hope this helps,

Cor
Nov 21 '05 #5

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

Similar topics

3
by: Jade | last post by:
Hi, I wanted to know if anyone know how to use the first column of the datagrid to display values that are pulled from a database, while the second column is one where i can add my own heading....
3
by: PeterZ | last post by:
Hi, In a running C# app with a datagrid control I select all rows in the dataGrid using CTRL-A, I then paste into some other app like notepad or Word but the column headings get left off. Is...
3
by: Richard | last post by:
I have a requirement to put a GDI style circle or rectangle border around the selected row of a datagrid/ It will overlap into the row above and below the selected row. Doing this in a the OnPaint...
1
by: Amber | last post by:
The DataGrid allows you to make columns visible or invisible on demand - even edit and other special columns. This article will show you how it is done. Some developers have reported problems...
10
by: Alan Lambert | last post by:
I am writing a web-based reporting tool and using a datagrid to display information returned from a database. I am displaying column headings from bound columns with no problems but I need to...
4
by: Jim Heavey | last post by:
I am wanting to change the headers on my datagrid in code because the contrents of my grid are dynamic and I was wondering how to do this. I do not see a property in the datagrid.columns which...
6
by: Agnes | last post by:
I understand it is impossible, but still curious to know "Can I freeze several column in the datagrid, the user can only scroll the first 3 columns (not verical), for the rest of the coulumn, it is...
2
by: Mac via DotNetMonster.com | last post by:
Hi all, I have a datagrid on a form which I have set the datasource (through the form designer) to be a dataset that I have added to the form, also through the form designer. I then have added a...
4
by: cooltech77 | last post by:
Hi, I am trying to build the following functionality in the datagrid. I have a lot of columns in the datagrid which are being populated from the database and the user needs to scroll...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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
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...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

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.