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. Sending data from a form to another

Sending data from a form to another

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

    Hi all, i want to know how can I add data in a form from another form and display it in a datagrid after adding it to the first form pleeease help thanx

    S S A 3 Replies Last reply
    0
    • O OlaMohammed

      Hi all, i want to know how can I add data in a form from another form and display it in a datagrid after adding it to the first form pleeease help thanx

      S Offline
      S Offline
      Stefan Troschuetz
      wrote on last edited by
      #2

      Passing Values between Forms in .NET 1.x with C# and VB.NET examples[^]


      "Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook

      www.troschuetz.de

      1 Reply Last reply
      0
      • O OlaMohammed

        Hi all, i want to know how can I add data in a form from another form and display it in a datagrid after adding it to the first form pleeease help thanx

        S Offline
        S Offline
        Sanjib Raj
        wrote on last edited by
        #3

        it will best if you use event handler in Child Form and Call it from Parent Form. class FrmChild { public event System.EventHandler addData; ......... ...... } class FrmParent {..... private void btnSchduler_ClickEvent(......) { FrmChild obj=new FrmChild(); obj.addData +=new EventHandler(objServices_addService); obj.ShowDialog(); } private void objServices_addService(object sender, EventArgs e) { //write code to Add in Data Grid.... } } Sanjit.rajbanshi@wlinktech.com

        1 Reply Last reply
        0
        • O OlaMohammed

          Hi all, i want to know how can I add data in a form from another form and display it in a datagrid after adding it to the first form pleeease help thanx

          A Offline
          A Offline
          AFSEKI
          wrote on last edited by
          #4

          First I decrypted your question :) Then I found out that, you can do it by creating a new constructor which takes a datatable in the second form. Then from first form, you send the datatable to the second forms constructor where it is used as Form2.CustomDataGrodView.DataSource = datagridViewFromConstructor. Or you can add a property(public DataTable NewDataSource {get; set;}) or method like (UpdateDataSource(DataTable newDataSource)) then call these from your First Form with a new DataTable. Hope this helps...

          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