CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    May 2014

    Trying to parse text from a form to another forms label..

    Im trying to parse a text from a textbox to a label. And it Works fine for the first one. But when i try to do it for the second label it wont Work.

    Morten should go right under february???

    Heres the code:
    namespace step1
        public partial class kalender : Form
            public kalender()
            //Gemmer input af indtastede værdier i textfelt
            private void kalender_FormClosed(object sender, FormClosedEventArgs e)
                Properties.Settings.Default.textbox = txtKalJan.Text;
                Properties.Settings.Default.textbox2 = txtKalFeb.Text;
            private void kalender_Load(object sender, EventArgs e)
                txtKalJan.Text = Properties.Settings.Default.textbox;
                txtKalFeb.Text = Properties.Settings.Default.textbox2;
            //instanciere overblik class i kalender forms knapevent
            private void btnKalUpdate_Click(object sender, EventArgs e)
                Overblik lbl1 = new Overblik(txtKalJan.Text);
                //Overblik lbl2 = new Overblik(txtKalFeb.Text);
      //Constructor så vi kan gemme lableinput fra tekstfeltet i kalender
            public Overblik(string lbl)
                lbljan.Text = lbl;
                //lblfeb.Text = lbl;
            //Save funktion af indtastede værdier
            private void Overblik_FormClosed(object sender, FormClosedEventArgs e)
                Properties.Settings.Default.label = lbljan.Text;
                Properties.Settings.Default.label2 = lblfeb.Text;
            private void Overblik_Load(object sender, EventArgs e)
                kal2 = new kalender();
    Can someone help med?

  2. #2

    Re: Trying to parse text from a form to another forms label..

    The question isn't clear and the code confusing. Points: Do not have code in FormClosed() event as at that point the form object may be null. FormClosing() is a good place to put in any code, if thats what you are asking for. If you are transferring data from one form to another, its best to use delegates- they are simple and callback when the work is done.

    BossMode Software

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Windows Mobile Development Center

Click Here to Expand Forum to Full Width

On-Demand Webinars (sponsored)

We have made updates to our Privacy Policy to reflect the implementation of the General Data Protection Regulation.