DataGridView with datatable, how prevent view all column?

  • Thread starter Thread starter mtczx232
  • Start date Start date
M

mtczx232

Datagrid view bound to datatable, view all fields from table, even I
add some column to DataGridView. to prevent it I must add all clolumn
to grid and set them unvisible except the column that I want to be
visible.

Have beter way to do that
 
Set the grid's AutoGenerateColumns property to false. Then it will
only display columns you define instead of every column in your data
source.
 

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

Back
Top