Data Grid Column Visibility in vb.net

B

Balu

Hi one n all,

I have a doubt on how to make the specified columns of the data grid
to visible.
That is,when i select a value from the combo box as 5 ,then it should
display only 5 columns in the data grid.
I'l be thankful if any one can help me out.

Regards,
Mahi.
 
G

Guest

Use "datagrid.column(index).visible = True" of DataGrid.

For ex. if 3 is selected in Combobox then write the following code:
Initially SET all the column of datagrid to False.

For intLoop as integer = 0 to combox.selectedtext
datagrid.column(intLoop).Visible = True
Next

Regards,
Sachin Saki
..NET Developer, Capgemini - INDIA

"Balu" ने लिखा:
 
B

Balu

Hi Sachin,
You have told to use :
"datagrid.column(index).visible=True"

But,there is no such property as "column"for datagrid,i tryed it,but its not
working .
Is there any other alternative???
If possible reply me.
Bye...Take care....
Regards,
Mahi

"Sachin Saki" <wrote in message >

Use "datagrid.column(index).visible = True" of DataGrid.
 
R

Ramu Nallamothu

Balu,

// Try the following

DataGridTableStyle ts = new DataGridTableStyle();
ts.MappingName = dataGrid1.DataMember;
dataGrid1.TableStyles.Add(ts);
dataGrid1.TableStyles[0].GridColumnStyles[col].Width = 0; // replace
'col' with your column number to hide.


Thanks
Ramu
 
G

Guest

try this:

DataGrid.Table(0).Column(0).Visible = False


Ramu Nallamothu said:
Balu,

// Try the following

DataGridTableStyle ts = new DataGridTableStyle();
ts.MappingName = dataGrid1.DataMember;
dataGrid1.TableStyles.Add(ts);
dataGrid1.TableStyles[0].GridColumnStyles[col].Width = 0; // replace
'col' with your column number to hide.


Thanks
Ramu



Balu said:
Hi Sachin,
You have told to use :
"datagrid.column(index).visible=True"

But,there is no such property as "column"for datagrid,i tryed it,but its
not working .
Is there any other alternative???
If possible reply me.
Bye...Take care....
Regards,
Mahi

"Sachin Saki" <wrote in message >

Use "datagrid.column(index).visible = True" of DataGrid.
 

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

Members online

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,535
Members
45,008
Latest member
obedient dusk

Latest Threads

Top