Datagrid

  • Thread starter Thread starter Young
  • Start date Start date
Y

Young

I got a table with 10 fields in it. I just want to display 3 fields on the
grid.

I've added a grid on the form and add 3 columns for the 3 fields.

I then created my datatable and bind it to the grid.

When I do this, the grid automaticall display all the 10 fields from my
table plus the 3 columns I've added in the grid.

Can someone please tell me how I can just display 3 fields from the table
(with 10 fields)?

In my datatable/dataset, I need all 10 fields but only display 3. The other
fields are used for something else.

TIA
Young
 
Young said:
I got a table with 10 fields in it. I just want to display 3 fields on the
grid.

I've added a grid on the form and add 3 columns for the 3 fields.

I then created my datatable and bind it to the grid.

When I do this, the grid automaticall display all the 10 fields from my
table plus the 3 columns I've added in the grid.

Can someone please tell me how I can just display 3 fields from the table
(with 10 fields)?

In my datatable/dataset, I need all 10 fields but only display 3. The
other fields are used for something else.

TIA
Young
Have you tried removing the unwanted columns from the datagrid in the
properties?
If you need specific guidance, identify the version of VS, and the project
type (esp. Windows or web).
 
I got a table with 10 fields in it. I just want to display 3 fields on the
grid.

I've added a grid on the form and add 3 columns for the 3 fields.

I then created my datatable and bind it to the grid.

When I do this, the grid automaticall display all the 10 fields from my
table plus the 3 columns I've added in the grid.

Can someone please tell me how I can just display 3 fields from the table
(with 10 fields)?

In my datatable/dataset, I need all 10 fields but only display 3. The other
fields are used for something else.

TIA
Young

Is this a DataGridView or really a DataGrid? DataGridView has a
property, on by default, that controls whether or not it should create
columns for all fields in the data source.
 
I got a table with 10 fields in it. I just want to display 3 fields on the
grid.

I've added a grid on the form and add 3 columns for the 3 fields.

I then created my datatable and bind it to the grid.

When I do this, the grid automaticall display all the 10 fields from my
table plus the 3 columns I've added in the grid.

Can someone please tell me how I can just display 3 fields from the table
(with 10 fields)?

In my datatable/dataset, I need all 10 fields but only display 3. The other
fields are used for something else.

TIA
Young

You can set AutoGenerateColumn property to false.
 
Thanks for all the help.

I got a table with 10 fields in it. I just want to display 3 fields on the
grid.

I've added a grid on the form and add 3 columns for the 3 fields.

I then created my datatable and bind it to the grid.

When I do this, the grid automaticall display all the 10 fields from my
table plus the 3 columns I've added in the grid.

Can someone please tell me how I can just display 3 fields from the table
(with 10 fields)?

In my datatable/dataset, I need all 10 fields but only display 3. The
other
fields are used for something else.

TIA
Young

You can set AutoGenerateColumn property to false.
 
Back
Top