Click here to Skip to main content
14,830,623 members
Home / Discussions / C#
   

C#

 
GeneralRe: getting result from the cmd prompt Pin
lune125-Aug-08 20:58
Memberlune125-Aug-08 20:58 
QuestionData entry validation and databinding Pin
Gulfraz Khan4-Aug-08 4:20
MemberGulfraz Khan4-Aug-08 4:20 
QuestionLoad Report Failed Pin
Er.bRijal4-Aug-08 3:49
MemberEr.bRijal4-Aug-08 3:49 
QuestionRe: Load Report Failed Pin
selcuks4-Aug-08 4:43
Memberselcuks4-Aug-08 4:43 
QuestionPass Paramters from Popup to page Pin
Agweet4-Aug-08 3:45
MemberAgweet4-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
MemberAgweet4-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
MemberAgweet4-Aug-08 20:23 
QuestionNot authorization to run a downloaded project Pin
Mauro Vezzoli4-Aug-08 3:40
MemberMauro Vezzoli4-Aug-08 3:40 
AnswerRe: Not authorization to run a downloaded project Pin
John Ad4-Aug-08 4:09
MemberJohn Ad4-Aug-08 4:09 
QuestionDomain (not host) from url Pin
Dana Tov4-Aug-08 3:20
MemberDana Tov4-Aug-08 3:20 
AnswerRe: Domain (not host) from url Pin
leppie4-Aug-08 3:22
Memberleppie4-Aug-08 3:22 
GeneralRe: Domain (not host) from url Pin
Dana Tov4-Aug-08 3:29
MemberDana 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
MemberNeutronMass4-Aug-08 3:17 
AnswerRe: Hot to detect a mouse hit on an image Pin
Dana Tov4-Aug-08 3:25
MemberDana Tov4-Aug-08 3:25 
GeneralRe: Hot to detect a mouse hit on an image Pin
NeutronMass4-Aug-08 3:40
MemberNeutronMass4-Aug-08 3:40 
GeneralRe: Hot to detect a mouse hit on an image Pin
NeutronMass4-Aug-08 3:43
MemberNeutronMass4-Aug-08 3:43 
GeneralRe: Hot to detect a mouse hit on an image Pin
vikas amin8-Aug-08 4:43
Membervikas amin8-Aug-08 4:43 
GeneralRe: Hot to detect a mouse hit on an image Pin
vikas amin4-Aug-08 4:57
Membervikas amin4-Aug-08 4:57 
GeneralRe: Hot to detect a mouse hit on an image Pin
NeutronMass4-Aug-08 5:35
MemberNeutronMass4-Aug-08 5:35 
GeneralRe: Hot to detect a mouse hit on an image Pin
vikas amin12-Aug-08 11:50
Membervikas amin12-Aug-08 11:50 
QuestionVista C# developer basics Pin
Stevo Z4-Aug-08 3:15
MemberStevo Z4-Aug-08 3:15 
AnswerRe: Vista C# developer basics Pin
John Ad4-Aug-08 4:54
MemberJohn 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.