datagridview column order problem...

T

trint

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
 
T

trint

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top