Datagrid

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
 
P

PvdG42

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).
 
J

Jack Jackson

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.
 
R

rohit.shrivastava04

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.
 
Y

Young

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.
 

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