473,503 Members | 1,656 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

datagridview column order problem...

Hello professionals,
I have a datagridview that displays columns based upon my sql select
statement.
I have additional columns that I want displayed in the datagridview I
wish to append
to the end of the last column named in the select statement sql
script:

string strSQL0 = "Select code, name, price, sale_price, cost, stock,
origin_zip, sort_order FROM sizes where product_id = '" +
Class1.productID.Trim() + "' order by sort_order asc";

and here is what I wand appending to the end of the order shown above
that displays in my datagridview:

This cell is not in the select statement because it is 4 radiobuttons
requiring a choice of one and no matter what I do, it always ends up
being the first column instead of the desired 6th column.
This cell is the only one listed in the "columns (collection)".

Any help is appreciated.
Thanks,
Trint

Jun 8 '07 #1
1 8309
On Jun 8, 7:59 am, trint <trinity.sm...@gmail.comwrote:
Hello professionals,
I have a datagridview that displays columns based upon my sql select
statement.
I have additional columns that I want displayed in the datagridview I
wish to append
to the end of the last column named in the select statement sql
script:

string strSQL0 = "Select code, name, price, sale_price, cost, stock,
origin_zip, sort_order FROM sizes where product_id = '" +
Class1.productID.Trim() + "' order by sort_order asc";

and here is what I wand appending to the end of the order shown above
that displays in my datagridview:

This cell is not in the select statement because it is 4 radiobuttons
requiring a choice of one and no matter what I do, it always ends up
being the first column instead of the desired 6th column.
This cell is the only one listed in the "columns (collection)".

Any help is appreciated.
Thanks,
Trint
I figured it out and here is the answer:

this.dataGridView7.Columns["Column1"].DisplayIndex = 8;

thanks,
Trint

Jun 8 '07 #2

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

Similar topics

1
6794
by: martin1 | last post by:
Hi, All, DataGridView is populated with all coumns from database since i need some columns data for condition statement, after that I want to show rest of column in the DataGridView, so how to...
1
2721
by: David Veeneman | last post by:
I've added an unbound column to a bound DataGridView, and I want the unbound column to be the last column in the grid. But whenever I recompile, the unbound column is the first column in the grid....
3
2470
by: Mike | last post by:
Dear group, I'm currrently investigating a bug within a piece of our software whereby if a DataGridView (bound directly to a DataTable) is ordered by column headers (containing lookup combo...
1
2065
by: John | last post by:
My columns are changing order. When I run my program the columns are in a different order than they were in design view. Is there any reason why this should happen?
0
2354
by: Mike | last post by:
Hey everyone... I've got three problems with a custom DataGridView column I've built following the "How To: Host Controls in Windows Forms DataGridView Cells" article. The base editing control...
1
2891
by: Chalkie | last post by:
Hello, I've hit what appears to be a serious problem with an unbound datagridview control that Ive added to a VB.Net program. Inadvertently I named one column 'Name' and a second 'Size'. The...
1
1462
by: scuba264 | last post by:
Hey all, I feel like an idiot, but for the life of me I cannot figure out how to do this. Using C#, I have a DataGridView set up with a few thousand rows in it. I need to sort it according to 3...
0
1806
by: Kevin S Gallagher | last post by:
I am working on a custom column from Code Project were I want to persist a value using the following code in the property HighlightBackgroundColor. Note the default color is "Red" but when changing...
0
2395
by: lenniekuah | last post by:
Hi Fellow Good Guys, I need your help, Please Help me. Surprising I encounterd another problem which never happened in VB.NET but in C# technique it causing problem. Here is the explanation...
0
7084
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7278
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,...
0
7458
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...
0
5578
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,...
0
4672
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...
0
3167
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...
0
3154
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1512
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
736
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.