1 Replies - 435 Views - Last Post: 05 February 2012 - 06:43 AM Rate Topic: -----

Topic Sponsor:

#1 lcfjoertoft  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 27
  • Joined: 09-July 11

Adding column to datagridview and bind it

Posted 05 February 2012 - 05:25 AM

I'm struggeling here.

I have a Datagridview with a bound datatable in it. Then I add a check box column to it.

When I click the headder of the DGV, it sorts the bound columns, and clears all checked checkboxes in the checkbox column.

How do I bind the checkboxcolumn to the rest of the table?
Is This A Good Question/Topic? 0
  • +

Replies To: Adding column to datagridview and bind it

#2 CharlieMay  Icon User is offline

  • This space intentionally left blank
  • member icon

Reputation: 960
  • View blog
  • Posts: 3,354
  • Joined: 25-September 09

Re: Adding column to datagridview and bind it

Posted 05 February 2012 - 06:43 AM

The best way to do this would be to add a datacolumn to your dataset.

 Dim dc As New DataColumn("TempCheck", System.Type.GetType("System.Boolean"))
 ds.Tables("YourTable").Columns.Add(dc)
This will then set the values of any checkboxes that the user checks so that when you sort the dgv, the dataset can maintain those checked values.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1