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

RE: Accessing DataGrid column properties

Asuming that you have a DataGrid DG - then

DG.columns[0].ItemStyle.Width = 100;
DG.columns[0].Visible = true;

should do the trick. You can also use the column name instead of the column
number as an index into the collection of columns.

Is that what you need?
"Eric B." wrote:
How do I access the properties of DataGrid columns that were created from a
DataTable source? I need to format the column sizes and make some invisible.

Thanks,

Eric B.
Oct 6 '08 #1
1 1278
"TD is PSP" <TD*****@discussions.microsoft.comwrote in message
news:DE**********************************@microsof t.com...
Asuming that you have a DataGrid DG - then

DG.columns[0].ItemStyle.Width = 100;
DG.columns[0].Visible = true;

should do the trick. You can also use the column name instead of the
column
number as an index into the collection of columns.

Is that what you need?
"Eric B." wrote:
>How do I access the properties of DataGrid columns that were created from
a
DataTable source? I need to format the column sizes and make some
invisible.

Thanks,

Eric B.

Yes thanks!

Now if I can figure how to set a tristate value programmatically...
Resizable wont take a bool or an int, hmm.

Cannot implicitly convert type 'bool' to
'System.Windows.Forms.DataGridViewTriState'

Eric B.

Oct 6 '08 #2

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

Similar topics

7
by: Pierluigi Terzoli | last post by:
Hi everybody, I need help for this problem: I'm using a DataGrid to Insert/Modify/Cancel data from a single table. At the moment, every cell modification of a pre-existing row is correctly update...
5
by: John Richardson | last post by:
I've been bothered for some time about my DataGrid not populating my rows very quickly. I have about 10K rows loading into the grid. I create a datatable dt with 2 columns, an ID and a display. ...
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...
2
by: damonf | last post by:
I'm currently trying to add an ASP hyperlink to a template column in a datagrid. The normal hyperlink column doesn't give me the ability to add attributes to the item. In my grid there are four...
1
by: gregoryenelson | last post by:
Hi. I am sitting here in a company with many people, but no othe programmers least of all asp.net ones. I have created a 'view' form on the INTRAnet, where many lines ar displayed in a...
0
by: optimizeit | last post by:
What I am attempting to do is import an Excel Workbook and display the worksheets in a datagrid dynamically. I am very close to getting this to work. I have to this point successfully imported a...
2
by: CSL | last post by:
I am using the DataGrid in a Windows Application, how can I adjust the widths of each column individually.
5
by: Genojoe | last post by:
I am using code from Help with two exceptions. (1) I increased the number of sample rows from 3 to 20, and (2) I anchored the datagrid to bottom of form so that I can change the size of the grid by...
13
by: pmcguire | last post by:
I have a DataGrid control for which I have also created several new extended DataGridColumnStyles. They behave pretty nicely, but I can't figure out how to implement Selected Item formatting for...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
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
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.