editing datagridview cells


Dim cmd As New SqlCommand(SQLSTR, conn)
reader = cmd.ExecuteReader()

Dim myDataTable As New DataTable
myDataTable.Load(reader)

If myDataTable.Rows.Count > 0 Then

datagridview1.DataSource = myDataTable
datagridview1.Columns(2).HeaderText = "QUANTITY"

datagridview1.AllowUserToAddRows = False
datagridview1.EditMode = DataGridViewEditMode.EditOnKeystrokeOrF2

datagridview1.Focus()
datagridview1.CurrentCell = datagridview1(2, 0)
datagridview1.BeginEdit(True)

Else
datagridview1.DataSource = myDataTable
End If

m_reader.Close()
cmd.Dispose()

i hve the follwoing code by which i bind the data to the grid
the grid has 4 columns PRODUCTNAME, QTY,RATE, AMOUNT

the user shld be able to edit the data in the column qty for as many rows it has
but i m not able to edit this column
how do i edit the values in the cells of column(1) ie qty

Comments

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

In this Discussion