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. datagrid, new form, selectrow

datagrid, new form, selectrow

Scheduled Pinned Locked Moved C#
helpcss
1 Posts 1 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.
  • R Offline
    R Offline
    Rmokkenstorm
    wrote on last edited by
    #1

    hi there. I have a problem. I want to select a row from the datagrid en put that in tekstboxes in a new form. this is what i've got so far: public delegate void CustomRowHandler(object sender, CustomRowEventArgs e); public static event CustomRowHandler CustomRow; ---------------------------------------------------------- public void dataGrid_MouseUp(object sender, System.Windows.Forms.MouseEventArgs e) { int rowIndex = dataGrid.CurrentRowIndex; if (CustomRow != null) { CustomRow(this, new CustomRowEventArgs(barry11,dataGrid, rowIndex)); ---------------------------------------------------------------- public class CustomRowEventArgs : EventArgs { Barry1 barry11; DataGrid grid; int row; public CustomRowEventArgs(Barry1 DSet,DataGrid Grid,int Row) { barry11 = DSet; grid = Grid; row = Row; } public Barry1 DSet { get { return barry11; } } public DataGrid Grid { get { return grid; } } public int Row { get { return row; } } ---------------------------------------------------- and on my second form.. ----------------------------------------------------- private void customHandler_CustomRow(object sender, WindowsApplication30.CustomRowEventArgs e) { Barry1 DSet = e.DSet; DataGrid grid = e.Grid; int row = e.Row; editLASTNAME.Text = e.DSet.Tables[0].Rows[e.Row]["Firstname"].ToString(); } InitializeComponent(); Form1.CustomRow += new WindowsApplication30.CustomRowHandler(customHandler_CustomRow); public DataForm1(Barry1 barry11, DataGrid dataGrid, int rowIndex) so.. if i put this peace of code from the second form in to my first form.. it words... if i put this peace of code in to my first form.. public void dataGrid_MouseUp(object sender, System.Windows.Forms.MouseEventArgs e) { int rowIndex = dataGrid.CurrentRowIndex; if (CustomRow != null) { CustomRow(this, new CustomRowEventArgs(barry11,dataGrid, rowIndex)); DataForm1 frm = new DataForm1 (barry11,dataGrid, dataGrid.CurrentRowIndex); frm.Show(); he opens the second form (DataForm1). he fills the textfield that was on the first form.. but he doesn's fill the textfield on the second form... can someone please help me

    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