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. display datagrid row on textBoxes

display datagrid row on textBoxes

Scheduled Pinned Locked Moved C#
csharpquestionvisual-studiohelp
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.
  • _ Offline
    _ Offline
    __horus__
    wrote on last edited by
    #1

    how can i display the datagrid row items in to textboxes when double clicked on that row. i'm using Visual studio.net 2003, and working on CSharp (C#). can anyone help me with code or an application??? thanks, horussssssssssssssssssssss:):sigh::sigh::sigh: hello

    W X _ 3 Replies Last reply
    0
    • _ __horus__

      how can i display the datagrid row items in to textboxes when double clicked on that row. i'm using Visual studio.net 2003, and working on CSharp (C#). can anyone help me with code or an application??? thanks, horussssssssssssssssssssss:):sigh::sigh::sigh: hello

      W Offline
      W Offline
      WillemM
      wrote on last edited by
      #2

      First you need to implement an eventhandler for the mouseup event of the datagrid. The following code can be inserted there:

      BindingManagerBase bmb = dataGrid.BindingContext[dataGrid.DataSource,dataGrid.DataMember];
      DataGrid.HitTestInfo hti = dataGrid.HitTest(e.X,e.Y);

      if(e.Button == MouseButtons.Left) {
      if(hti.Type == DataGrid.HitTestType.Cell || hti.Type == DataGrid.HitTestType.RowHeader) {
      bmb.Position = hti.Row;

      //Setup dataview for the textboxes
      dataView1.RowFilter = string.Format("Id = '{0}'",(bmb.Current as DataRowView)\["Id"\]);
      

      }
      }

      You can then bind the textboxes to a dataview that has the same table as the datagrid. WM.
      What about weapons of mass-construction?

      1 Reply Last reply
      0
      • _ __horus__

        how can i display the datagrid row items in to textboxes when double clicked on that row. i'm using Visual studio.net 2003, and working on CSharp (C#). can anyone help me with code or an application??? thanks, horussssssssssssssssssssss:):sigh::sigh::sigh: hello

        X Offline
        X Offline
        xrado
        wrote on last edited by
        #3

        directly form datagrid textBox.Text= dataGrid1[rowNum, collNum].ToString(); or directly from dataset textBox.Text = ds.Tables["table"].Rows[rowNum]["coll_name"].ToString(); add it to double event on datagrid

        1 Reply Last reply
        0
        • _ __horus__

          how can i display the datagrid row items in to textboxes when double clicked on that row. i'm using Visual studio.net 2003, and working on CSharp (C#). can anyone help me with code or an application??? thanks, horussssssssssssssssssssss:):sigh::sigh::sigh: hello

          _ Offline
          _ Offline
          __horus__
          wrote on last edited by
          #4

          thanks, now i'm on my work, but as soon as i can i'll try your tips. ;)

          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