Calling datas from another form?

This is a discussion on Calling datas from another form? within the C# Programming forums, part of the General Programming Boards category; i have 3 form . In the first form there is login for duty after duty login the system , ...

  1. #1
    Registered User Aga^^'s Avatar
    Join Date
    Aug 2008
    Posts
    71

    Calling datas from another form?

    i have 3 form . In the first form there is login for duty after duty login the system , in the second form student must enter. In the 3rd form i want the student name and surname must seen . There are 2 labels in the 2nd form , one is for student's name the other is for student's surname.How can i call them to the 3rd form?

  2. #2
    Confused Magos's Avatar
    Join Date
    Sep 2001
    Location
    Sweden
    Posts
    3,145
    1) Pass as arguments
    2) Use public properties
    MagosX.com

    Give a man a fish and you feed him for a day.
    Teach a man to fish and you feed him for a lifetime.

  3. #3
    Registered User Aga^^'s Avatar
    Join Date
    Aug 2008
    Posts
    71
    magos, i tried to do something, did the ad and soyad variables public in the frmOgrenciGiris.cs form.
    Code:
            private string ad;
            public string AD
            {
                get { return ad; }
            }
    
            private string soyad;
            public string SOYAD
            {
                get { return soyad; }
            }
    Code:
                        ad = readerSel.GetString(readerSel.GetOrdinal("s_rname"));
                        soyad = readerSel.GetString(readerSel.GetOrdinal("s_surname"));
    
                            lblad.Text = ad;
                            lblsoyad.Text = soyad;
    and i assigned the lblad adn lblsoyad to the ad and soyad

    after that i call them in another form
    Code:
    public partial class frmAna : Form
        {
            public frmPersonelGiris MainForm;
            frmOgrenciGiris MainOgr = new frmOgrenciGiris();
    
    public void frmAna_Load(object sender, EventArgs e)
            {
                lblAd.Text = MainOgr.AD;
                lblSoyad.Text = MainOgr.SOYAD;
    }
    but lblAd.Text and lblSoyad.Text did not appear in the form
    what can i do now?
    Last edited by Aga^^; 02-06-2009 at 03:05 AM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Stack issues when calling a COM library
    By notnot in forum C Programming
    Replies: 3
    Last Post: 06-01-2009, 03:12 AM
  2. Reopening a form ?
    By Aga^^ in forum C# Programming
    Replies: 1
    Last Post: 02-11-2009, 09:28 AM
  3. Accessing main form from functions in other classes
    By pj_martins in forum C++ Programming
    Replies: 1
    Last Post: 11-05-2004, 09:27 AM
  4. My UserControls dissapear off my form
    By zMan in forum C# Programming
    Replies: 2
    Last Post: 09-15-2004, 09:55 AM
  5. Making an MFC form to suit
    By TJJ in forum Windows Programming
    Replies: 1
    Last Post: 04-17-2004, 12:20 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21