Click here to Skip to main content
15,914,255 members
Home / Discussions / C#
   

C#

 
GeneralRe: Enable/Disable of texbox Pin
sreejith ss nair26-May-04 20:51
sreejith ss nair26-May-04 20:51 
GeneralRe: Enable/Disable of texbox Pin
HappyKim27-May-04 14:01
HappyKim27-May-04 14:01 
GeneralRe: Enable/Disable of texbox Pin
sreejith ss nair27-May-04 17:51
sreejith ss nair27-May-04 17:51 
GeneralRe: Enable/Disable of texbox Pin
sreejith ss nair27-May-04 18:14
sreejith ss nair27-May-04 18:14 
GeneralAccessing objects Pin
John L. DeVito24-May-04 10:29
professionalJohn L. DeVito24-May-04 10:29 
GeneralRe: Accessing objects Pin
frank2124-May-04 10:58
frank2124-May-04 10:58 
GeneralRe: Accessing objects Pin
Heath Stewart24-May-04 11:24
protectorHeath Stewart24-May-04 11:24 
GeneralRe: Accessing objects Pin
Heath Stewart24-May-04 11:33
protectorHeath Stewart24-May-04 11:33 
You need to pass an instance of the first form to your second form. For example:
public class Form1 : Form
{
  internal Label label1;
  private Button button1;
  public Form1()
  {
    label = new Label();
    button1 = new Button();
    // Initialize...
    button1.Click += new EventHandler(button1_Click);
  }
  private void button1_Click(object sender, EventArgs e)
  {
    using (Form2 form = new Form2(this))
      form.ShowDialog(this);
  }
}
public class Form2 : Form
{
  private TextBox textBox1;
  private Button button1;
  private Form1 form;
  public Form2(Form1 form)
  {
    this.form = form;
    textBox1 = new TextBox();
    button1 = new Button();
    // Initialize....
    button1.Click += new EventHandler(button1_Click);
  }
  private void button1_Click(object sender, EventArgs e)
  {
    if (form != null) form.Label.Text = textBox1.Text;
  }
}


 

Microsoft MVP, Visual C#
My Articles
GeneralFitting Buttons to Bitmaps Pin
Guinness4Strength24-May-04 10:28
Guinness4Strength24-May-04 10:28 
GeneralRe: Fitting Buttons to Bitmaps Pin
Heath Stewart24-May-04 11:35
protectorHeath Stewart24-May-04 11:35 
GeneralRe: Fitting Buttons to Bitmaps Pin
Guinness4Strength24-May-04 15:15
Guinness4Strength24-May-04 15:15 
GeneralRe: Fitting Buttons to Bitmaps Pin
Heath Stewart25-May-04 2:36
protectorHeath Stewart25-May-04 2:36 
GeneralRe: Fitting Buttons to Bitmaps Pin
Guinness4Strength24-May-04 15:25
Guinness4Strength24-May-04 15:25 
GeneralCR 9 for C#.net Question Pin
frank2124-May-04 10:17
frank2124-May-04 10:17 
GeneralRe: CR 9 for C#.net Question Pin
Heath Stewart24-May-04 11:40
protectorHeath Stewart24-May-04 11:40 
GeneralAdding Menu Items in C# using Visual Studio Tools for Microsoft Office Pin
mevenson24-May-04 8:39
mevenson24-May-04 8:39 
Generaldataset error Pin
MrJJKoolJ24-May-04 8:23
MrJJKoolJ24-May-04 8:23 
GeneralRe: dataset error Pin
Marc Clifton24-May-04 8:37
mvaMarc Clifton24-May-04 8:37 
GeneralRe: dataset error Pin
Dave Kreskowiak24-May-04 8:39
mveDave Kreskowiak24-May-04 8:39 
GeneralRe: dataset error Pin
MrJJKoolJ24-May-04 8:57
MrJJKoolJ24-May-04 8:57 
GeneralRe: dataset error Pin
sreejith ss nair24-May-04 20:08
sreejith ss nair24-May-04 20:08 
GeneralRe: dataset error Pin
sreejith ss nair24-May-04 20:09
sreejith ss nair24-May-04 20:09 
General64bit Pin
Dimitris Iliopoulos24-May-04 7:54
Dimitris Iliopoulos24-May-04 7:54 
GeneralRe: 64bit Pin
Marc Clifton24-May-04 8:10
mvaMarc Clifton24-May-04 8:10 
GeneralRe: 64bit Pin
Dave Kreskowiak24-May-04 8:22
mveDave Kreskowiak24-May-04 8:22 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.