Click here to Skip to main content
15,891,136 members
Home / Discussions / C#
   

C#

 
GeneralRe: getting result from the cmd prompt Pin
lune125-Aug-08 20:58
lune125-Aug-08 20:58 
QuestionData entry validation and databinding Pin
Gulfraz Khan4-Aug-08 4:20
Gulfraz Khan4-Aug-08 4:20 
QuestionLoad Report Failed Pin
Er.bRijal4-Aug-08 3:49
Er.bRijal4-Aug-08 3:49 
QuestionRe: Load Report Failed Pin
selcuks4-Aug-08 4:43
selcuks4-Aug-08 4:43 
QuestionPass Paramters from Popup to page Pin
Agweet4-Aug-08 3:45
Agweet4-Aug-08 3:45 
AnswerRe: Pass Paramters from Popup to page Pin
Alaric_4-Aug-08 3:57
professionalAlaric_4-Aug-08 3:57 
GeneralRe: Pass Paramters from Popup to page Pin
Agweet4-Aug-08 4:07
Agweet4-Aug-08 4:07 
AnswerRe: Pass Paramters from Popup to page Pin
DaveyM694-Aug-08 10:19
professionalDaveyM694-Aug-08 10:19 
Use delegates. There's plenty of examples here and on the internet.

Here's a very simple example to get you started.

Create a Windows Forms Application and call it DelegateExample.
You'll already have Form1. Add another form and call it Form2 then add a TextBox to it called textBox1.

Change all the code in Form1.cs to this:
using System;
using System.Windows.Forms;

namespace DelegateExample
{
    public delegate void UpdateText(string text);

    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
        private void Form1_Load(object sender, EventArgs e)
        {
            Form2 frm2 = new Form2();
            frm2.SendText = new UpdateText(Update);
            frm2.Show();
        }
        private void Update(string text)
        {
            Text = text;
        }
    }
}

Change all the code in Form2.cs to this:
using System;
using System.Windows.Forms;

namespace DelegateExample
{
    public partial class Form2 : Form
    {
        public UpdateText SendText;
        public Form2()
        {
            InitializeComponent();
        }
        private void textBox1_TextChanged(object sender, EventArgs e)
        {
            SendText(textBox1.Text);
        }
    }
}

When you run this - type in the TextBox on Form2 and the Text in the title bar of Form1 will change as you type.

Study the code so you understand what it's doing then you can use this principal in your situation with very little modification.

Dave
BTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)

GeneralRe: Pass Paramters from Popup to page Pin
Agweet4-Aug-08 20:23
Agweet4-Aug-08 20:23 
QuestionNot authorization to run a downloaded project Pin
Mauro Vezzoli4-Aug-08 3:40
Mauro Vezzoli4-Aug-08 3:40 
AnswerRe: Not authorization to run a downloaded project Pin
John Ad4-Aug-08 4:09
John Ad4-Aug-08 4:09 
QuestionDomain (not host) from url Pin
Dana Tov4-Aug-08 3:20
Dana Tov4-Aug-08 3:20 
AnswerRe: Domain (not host) from url Pin
leppie4-Aug-08 3:22
leppie4-Aug-08 3:22 
GeneralRe: Domain (not host) from url Pin
Dana Tov4-Aug-08 3:29
Dana Tov4-Aug-08 3:29 
AnswerRe: Domain (not host) from url Pin
Manas Bhardwaj7-Aug-08 6:02
professionalManas Bhardwaj7-Aug-08 6:02 
QuestionHow to detect a mouse hit on an image [modified] Pin
NeutronMass4-Aug-08 3:17
NeutronMass4-Aug-08 3:17 
AnswerRe: Hot to detect a mouse hit on an image Pin
Dana Tov4-Aug-08 3:25
Dana Tov4-Aug-08 3:25 
GeneralRe: Hot to detect a mouse hit on an image Pin
NeutronMass4-Aug-08 3:40
NeutronMass4-Aug-08 3:40 
GeneralRe: Hot to detect a mouse hit on an image Pin
NeutronMass4-Aug-08 3:43
NeutronMass4-Aug-08 3:43 
GeneralRe: Hot to detect a mouse hit on an image Pin
vikas amin8-Aug-08 4:43
vikas amin8-Aug-08 4:43 
GeneralRe: Hot to detect a mouse hit on an image Pin
vikas amin4-Aug-08 4:57
vikas amin4-Aug-08 4:57 
GeneralRe: Hot to detect a mouse hit on an image Pin
NeutronMass4-Aug-08 5:35
NeutronMass4-Aug-08 5:35 
GeneralRe: Hot to detect a mouse hit on an image Pin
vikas amin12-Aug-08 11:50
vikas amin12-Aug-08 11:50 
QuestionVista C# developer basics Pin
Stevo Z4-Aug-08 3:15
Stevo Z4-Aug-08 3:15 
AnswerRe: Vista C# developer basics Pin
John Ad4-Aug-08 4:54
John Ad4-Aug-08 4:54 

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.