Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Windows Forms
  4. How to set cell value of datagridview on cell double click?

How to set cell value of datagridview on cell double click?

Scheduled Pinned Locked Moved Windows Forms
tutorialquestion
4 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    monuSaini
    wrote on last edited by
    #1

    Hello Friends, I am not able to set the cell value of datagridview on cell double click. here is the code on cell double click : GV.Rows(e.RowIndex).Cells(e.ColumnIndex).ReadOnly = False GV.Rows(e.RowIndex).Cells(e.ColumnIndex).value = "TEST" It is giving System.Data.ReadOnlyException. Thanks & Regards, Rahul

    rahul saini

    H 1 Reply Last reply
    0
    • M monuSaini

      Hello Friends, I am not able to set the cell value of datagridview on cell double click. here is the code on cell double click : GV.Rows(e.RowIndex).Cells(e.ColumnIndex).ReadOnly = False GV.Rows(e.RowIndex).Cells(e.ColumnIndex).value = "TEST" It is giving System.Data.ReadOnlyException. Thanks & Regards, Rahul

      rahul saini

      H Offline
      H Offline
      Henry Minute
      wrote on last edited by
      #2

      What is the DataSource for the DataGridView? What is the full error message?

      Henry Minute Do not read medical books! You could die of a misprint. - Mark Twain Girl: (staring) "Why do you need an icy cucumber?" “I want to report a fraud. The government is lying to us all.”

      M 1 Reply Last reply
      0
      • H Henry Minute

        What is the DataSource for the DataGridView? What is the full error message?

        Henry Minute Do not read medical books! You could die of a misprint. - Mark Twain Girl: (staring) "Why do you need an icy cucumber?" “I want to report a fraud. The government is lying to us all.”

        M Offline
        M Offline
        monuSaini
        wrote on last edited by
        #3

        Hello Henry, I am using DataGridView and bind it with DataTable. Error Description: DataGridView column bound to a read-only field must have ReadOnly set to True. above error comes on this statement: GV.Columns(e.ColumnIndex).ReadOnly = False ==================other error:============ this error occur on : GV.Rows(e.RowIndex).Cells(e.ColumnIndex).ReadOnly = False GV.Rows(e.RowIndex).Cells(e.ColumnIndex).Value = "text" DataGridView Default Error Dialog The following exceptions occurred in the DataGridView System.Data.ReadOnlyException: Column 'Status' is Read only at System.Data.Datarow.set_Item(DataColumn column, Object value) at System.Data.DatarowView.SetColumnValue(DataColumn Column, Object value) at System.Data.DataColumnPropertyDescriptor.SetValue(Object Component, Object value) at System.Windows.Forms.DataGridView.DataGridViewDataConnection.PushValue(Int32BoundColumnIndex, Int32 columnIndex, Int32 rowIndex, Object value) To replace this default dialog please handle the DataError event Regards Rahul

        rahul saini

        H 1 Reply Last reply
        0
        • M monuSaini

          Hello Henry, I am using DataGridView and bind it with DataTable. Error Description: DataGridView column bound to a read-only field must have ReadOnly set to True. above error comes on this statement: GV.Columns(e.ColumnIndex).ReadOnly = False ==================other error:============ this error occur on : GV.Rows(e.RowIndex).Cells(e.ColumnIndex).ReadOnly = False GV.Rows(e.RowIndex).Cells(e.ColumnIndex).Value = "text" DataGridView Default Error Dialog The following exceptions occurred in the DataGridView System.Data.ReadOnlyException: Column 'Status' is Read only at System.Data.Datarow.set_Item(DataColumn column, Object value) at System.Data.DatarowView.SetColumnValue(DataColumn Column, Object value) at System.Data.DataColumnPropertyDescriptor.SetValue(Object Component, Object value) at System.Windows.Forms.DataGridView.DataGridViewDataConnection.PushValue(Int32BoundColumnIndex, Int32 columnIndex, Int32 rowIndex, Object value) To replace this default dialog please handle the DataError event Regards Rahul

          rahul saini

          H Offline
          H Offline
          Henry Minute
          wrote on last edited by
          #4

          then clearly the problem is that the column in the DataTable is readonly, so presumably it is in the underlying database. Trying to change the ReadOnly property in your DataGridView cannot possibly alter this. You have to investigate, and find out why the underlying data is readonly. DataColumn has a ReadOnly property and maybe this is being set to true somewhere else in your code. There are loads and loads of possible reasons, but from the error message, it clearly is not the DataGridView that is causing the problem.

          Henry Minute Do not read medical books! You could die of a misprint. - Mark Twain Girl: (staring) "Why do you need an icy cucumber?" “I want to report a fraud. The government is lying to us all.”

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups