3 Replies - 4679 Views - Last Post: 22 July 2012 - 07:09 PM Rate Topic: -----

#1 maiOHmai  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 86
  • Joined: 09-July 12

datagridview edit mode

Posted 22 July 2012 - 04:24 AM

i have a datagridview, where in the data came from my access database. it has 10-15 columns depending on what i would search. i have declared the first column as a datagridviewcheckbox column and the rest are just normal datagridview column.. i have set the whole datagridview edit mode into "editOnEnter" so that i can click the checkboxes on the checkbox column. the problem is that i can edit all the other columns because i've set its edit mode on editOnEnter. what i want to happen is to set the editMode: editOnEnter only in the datagridviewcheckbox column and the rest would be editmode: edit programmatically. is that possoble?

Is This A Good Question/Topic? 0
  • +

Replies To: datagridview edit mode

#2 sela007  Icon User is offline

  • D.I.C Addict

Reputation: 138
  • View blog
  • Posts: 838
  • Joined: 21-December 11

Re: datagridview edit mode

Posted 22 July 2012 - 06:58 AM

in cell mouse down event you can set editmode depending on column index.
you can find columnindex in mouseeventargs e.
Was This Post Helpful? 0
  • +
  • -

#3 maiOHmai  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 86
  • Joined: 09-July 12

Re: datagridview edit mode

Posted 22 July 2012 - 06:56 PM

how would i do that? im using this code,

  Private Sub dgvSearch2_CellMouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellMouseEventArgs) Handles dgvSearch2.CellMouseDown

        If dgvSearch2.CurrentCell.ColumnIndex = 0 Then
            dgvSearch2.EditMode = DataGridViewEditMode.EditOnEnter

        End If


    End Sub]


well, definitely the code would only set the dgvSearch2 EditMode into EditOnEnter. how will I declare EditOnEnter on the first column only?

This post has been edited by maiOHmai: 22 July 2012 - 07:04 PM

Was This Post Helpful? 0
  • +
  • -

#4 sela007  Icon User is offline

  • D.I.C Addict

Reputation: 138
  • View blog
  • Posts: 838
  • Joined: 21-December 11

Re: datagridview edit mode

Posted 22 July 2012 - 07:09 PM

use
e.ColumnIndex

instead
dgvSearch2.CurrentCell.ColumnIndex


Because in CellMouseDown, dgvSearch2.CurrentCell is not changed yet.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1