locked
forms and text boxes RRS feed

  • Question

  •  

    I have a form with a text box in form1.cs with the following empty code

    public void diagBox_TextChanged(object sender, EventArgs e)

    {

    }

     

    I have another class which I am tring to write some text to this text box. by using

    Form1 Form = (Form1)Application.OpenForms["Form1"];

     

    I am tring to write to it by

    Form.diagBox.Text("some text");

     

    but it does not give me this option all it gives me is

    Form.diagBox_TextChanged and I cant write anything to the box.

     

    Can anyone help me here. I just started the program so this is really as far as I am on it for now.

     

    Sunday, February 10, 2008 7:51 PM

Answers

  • Had the same problem in a project, at loading I wanted to have a splash window visible, but then feed that splashwindow with info about what's going on...

    The solution is quite simple really, add another public method to your form...

     

    public void showInfo(string info)

    {

    this.diagBox.Text = info;

    }

     

    Since you could see diagBox_TextChanged(object sender, EventArgs e) from your other forms, without a doubt you can now also see the new showInfo(string info) method.
    Monday, February 11, 2008 10:37 AM

All replies

  • Sunday, February 10, 2008 9:10 PM
  • Thanks but I cant find what i am looking for there.

    Sunday, February 10, 2008 10:17 PM
  • Had the same problem in a project, at loading I wanted to have a splash window visible, but then feed that splashwindow with info about what's going on...

    The solution is quite simple really, add another public method to your form...

     

    public void showInfo(string info)

    {

    this.diagBox.Text = info;

    }

     

    Since you could see diagBox_TextChanged(object sender, EventArgs e) from your other forms, without a doubt you can now also see the new showInfo(string info) method.
    Monday, February 11, 2008 10:37 AM
  •  

    I figured it out thanks guys.
    Tuesday, February 12, 2008 3:49 PM