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. C#
  4. DataGridView

DataGridView

Scheduled Pinned Locked Moved C#
questioncsharphelp
4 Posts 3 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.
  • C Offline
    C Offline
    CodingYoshi
    wrote on last edited by
    #1

    I have a DataGridView with many DataGridViewTextBoxColumn(s). As soon as the value is changed within the cell I want to send it to my object--not once the cell loses focus--how can I do this? I tried to cast it to a textbox and created an event handler for TextBox's TextChanged event but the problem is I need the column and row info which you normally access through e.ColumnIndex and e.RowIndex of CellEndEdit and other events. Any ideas? One thing I can do is on CellEnter I can grab the column number and row number and save it in a variable and use it later but is there an alternative? I need realtime event like the textbox's TextChanged event.

    CodingYoshi Visual Basic is for basic people, C# is for sharp people. Farid Tarin '07

    C 1 Reply Last reply
    0
    • C CodingYoshi

      I have a DataGridView with many DataGridViewTextBoxColumn(s). As soon as the value is changed within the cell I want to send it to my object--not once the cell loses focus--how can I do this? I tried to cast it to a textbox and created an event handler for TextBox's TextChanged event but the problem is I need the column and row info which you normally access through e.ColumnIndex and e.RowIndex of CellEndEdit and other events. Any ideas? One thing I can do is on CellEnter I can grab the column number and row number and save it in a variable and use it later but is there an alternative? I need realtime event like the textbox's TextChanged event.

      CodingYoshi Visual Basic is for basic people, C# is for sharp people. Farid Tarin '07

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      So, if I type in 'this is a stupid idea', you want to send 21 change messages ? Do you want to save you data 21 times ? I would imagine the way to do this, is to set the Tag of the Textbox to contain the column and row, so you can parse it from there.

      Christian Graus Driven to the arms of OSX by Vista.

      C 1 Reply Last reply
      0
      • C Christian Graus

        So, if I type in 'this is a stupid idea', you want to send 21 change messages ? Do you want to save you data 21 times ? I would imagine the way to do this, is to set the Tag of the Textbox to contain the column and row, so you can parse it from there.

        Christian Graus Driven to the arms of OSX by Vista.

        C Offline
        C Offline
        CodingYoshi
        wrote on last edited by
        #3

        I actually did it by saving the column number and the row number at CellEnter.

        Christian Graus wrote:

        So, if I type in 'this is a stupid idea', you want to send 21 change messages ?

        Yes.

        Christian Graus wrote:

        Do you want to save you data 21 times ?

        No, just probe the object 21 times. For example, private void textBox_TextChanged(Object sender, EventArgs e) { this.customer.Name = this.textBox.Text; } where customer is the object is I am probing.

        CodingYoshi Visual Basic is for basic people, C# is for sharp people. Farid Tarin '07

        M 1 Reply Last reply
        0
        • C CodingYoshi

          I actually did it by saving the column number and the row number at CellEnter.

          Christian Graus wrote:

          So, if I type in 'this is a stupid idea', you want to send 21 change messages ?

          Yes.

          Christian Graus wrote:

          Do you want to save you data 21 times ?

          No, just probe the object 21 times. For example, private void textBox_TextChanged(Object sender, EventArgs e) { this.customer.Name = this.textBox.Text; } where customer is the object is I am probing.

          CodingYoshi Visual Basic is for basic people, C# is for sharp people. Farid Tarin '07

          M Offline
          M Offline
          MadArtSoft
          wrote on last edited by
          #4

          If you don't want to send 21 times message then you should think about how to catch your changes. One possibility is On leave event but you don't want do that. I think you should use on leave cell event.

          C# controls, .Net components. Help Desk Software

          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