473,666 Members | 2,053 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

c# datagrid does not set GridColumnStyle s

I am using c#.net 2003 and have an an application with a datagrid. The
binding is with an array of structs. Everything works ok except the header
text is the struct element names and they override any GridColumnStyle s
properties I set. Additionally, the GridColumnStyle s width I set does not get
updated on the datagrid. Any other user have this problem or some insight
into what may be going on.
Thanks,
Jim
Nov 16 '05 #1
2 4675
I have had a number of problems with custom styles but to help you please
attach code for reviewal
"Jim Dougherty" <Ji**********@d iscussions.micr osoft.com> wrote in message
news:79******** *************** ***********@mic rosoft.com...
I am using c#.net 2003 and have an an application with a datagrid. The
binding is with an array of structs. Everything works ok except the header
text is the struct element names and they override any GridColumnStyle s
properties I set. Additionally, the GridColumnStyle s width I set does not get updated on the datagrid. Any other user have this problem or some insight
into what may be going on.
Thanks,
Jim

Nov 16 '05 #2
Here is the code from a button_click event:
//Populate the struct array
data[0].SetData("Iin", "Input Current");
data[1].SetData("Vo_HL NL_pct", "High line full load output voltage");

//Create new table style and mapping name
DataGridTableSt yle ts = new DataGridTableSt yle();
ts.MappingName = "Table";

//Create STEP column styles, mapping name and header text
//Bug: header text does not show...Width not changed
DataGridTextBox Column cs1 = new DataGridTextBox Column();
cs1.MappingName ="STEP";
cs1.HeaderText= "STEPXxxx";
cs1.Alignment=H orizontalAlignm ent.Center;
cs1.Width=200;
ts.GridColumnSt yles.Add(cs1);

//Create STEP column styles, mapping name and header text
//Bug: Width not changed
DataGridTextBox Column cs2 = new DataGridTextBox Column();
cs2.MappingName ="STEP_DESCRIPT ION";
cs2.HeaderText= "STEPX_DESCRIPT ION";
cs2.Alignment=H orizontalAlignm ent.Center;
cs2.Width=200;
ts.GridColumnSt yles.Add(cs2);

// Add the tablestyle to the datagrid adn bind
dataGrid1.Table Styles.Add(ts);
dataGrid1.DataS ource=data;
currencyManager = (CurrencyManage r)dataGrid1.Bin dingContext[data];

Thanks for any help you can give
Jim

"Darryn Ross" wrote:
I have had a number of problems with custom styles but to help you please
attach code for reviewal
"Jim Dougherty" <Ji**********@d iscussions.micr osoft.com> wrote in message
news:79******** *************** ***********@mic rosoft.com...
I am using c#.net 2003 and have an an application with a datagrid. The
binding is with an array of structs. Everything works ok except the header
text is the struct element names and they override any GridColumnStyle s
properties I set. Additionally, the GridColumnStyle s width I set does not

get
updated on the datagrid. Any other user have this problem or some insight
into what may be going on.
Thanks,
Jim


Nov 16 '05 #3

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

Similar topics

3
1354
by: Job Lot | last post by:
I am trying to implement searchable DataGrid. I am creating a DataSet object with DataRelation on form load, as follows: Private Sub BindDataGrid() Dim planTS As New DataGridTableStyle Dim appTS As New DataGridTableStyle Try 'Call ExecuteDataset static method of SqlHelper class that returns a Dataset. myDS = SqlHelper.ExecuteDataset(strConn, CommandType.StoredProcedure, "spSearchPlanDetails")
0
1565
by: Job Lot | last post by:
I have an Expense Data Entry form which contains a DataGrid showing various expense categories. There are three columns Description, Cash Exp, Credit Exp, where Description column is readonly. Users have to press a checkbox to specify whether they want to use DataGrid to provide break-up or provide total value in textbox. Now when checkbox is unchecked I am setting the Enabled property of DataGrid to False and vice versa. The problem is...
0
3190
by: Morné | last post by:
Hi how do I validate a text value in a datagrid e.g. the user is only allowed to type in a Y or a N. I specifically have a problem with using the PropertyDescriptorCollection. I get the following error: "Additional information: Cannot create a child list for field Query." Below my existing code:
3
2421
by: Peter | last post by:
I have a datagrid on WinForm and I am trying to format the Grid. I am using the following code, the code runs fine, but nothing happens after it runs, the datagrid does not change (with data in the grid or with out any data) DataGridTableStyle gridStyle = new DataGridTableStyle(); gridStyle.MappingName = "Test"; DataGrid1.TableStyles.Add(gridStyle); gridStyle.GridColumnStyles.Width = 100; gridStyle.GridColumnStyles.HeaderText="Test...
24
10750
by: Mike L | last post by:
This is for a Win form, in C# 2005. I want to load a datagrid, make some columns width 0, and then clean out the record I added. I get the error message, ""Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index"" I have tried, -1,0,1,2 for the index, and I get the same error message on each try.
4
1824
by: Steve | last post by:
I am fairly new to VB.NET, and I am rewriting an application I wrote a while back, also in VB.NET. I aplied some new things I learned. Anyway, here is my problem....... I have a custom DataGrid with a buttonRow that does a delete function for me. Microsoft support helped me back then to get this done. Here is part of the code that creates the dataGrid: Dim ButtonColStyle As DataGridButtonColumn
4
1411
by: ElenaR | last post by:
I am having two issues with my datagrid. First, my column headers are not displaying. Second, the grid runs and displays correctly (except the headers) the first time. When the grid runs for the second time I get an error An unhandled exception of type 'System.ArgumentException' occurred in system.windows.forms.dl Additional information: Cannot create a child list for field Additional The code is below. Does anyone see the error
17
7425
by: Mike Fellows | last post by:
im trying (unsucessfully) to add a checkbox column to my datagrid i basically have a datagrid that im populating from a dataset Me.DataGrid1.DataSource = ds.Tables(0) the datagrid then has 5 columns in it but i need to add a sixth column which will be my checkbox column - any help or pointers with this would be great
3
4677
by: Aziz | last post by:
1. I have a shopping basket DataGrid with a list of products. What I want to do is when the user clicks on a row, a button will become visible/be created that allows user to edit the quantity. The button will be dynamic and always show up on the same Y-axis position as the selected row. So, how do I get back the X, Y co-ordinates of a specific row in a datagrid relative to the form? 2. I managed to change individual column width using:
6
2238
by: Doug Bell | last post by:
Hi I have a DataGrid with some hidden columns and also some read Only and some ComboBox Columns. Sandard Tabbing through the Datagrid sees the focus go to the hidden columns requiring further Tabbing to get to the desired column but it works fine stopping correctly on the ComboBox column. I have built a routine to test whether the use is Tabbing forward or back (Shift Tab) by looking at the last location, not by trapping the Keys. If
0
8869
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8781
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8551
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8639
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7386
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5664
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4198
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4368
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1775
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.