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

C#

 
GeneralRe: Subscription (VB6 to C#) Pin
JSvard19-May-11 23:53
JSvard19-May-11 23:53 
GeneralRe: Subscription (VB6 to C#) Pin
RobCroll20-May-11 0:29
RobCroll20-May-11 0:29 
GeneralRe: Subscription (VB6 to C#) Pin
JSvard20-May-11 1:08
JSvard20-May-11 1:08 
AnswerRe: Subscription (VB6 to C#) Pin
BobJanova20-May-11 3:28
BobJanova20-May-11 3:28 
GeneralRe: Subscription (VB6 to C#) Pin
JSvard20-May-11 3:47
JSvard20-May-11 3:47 
GeneralRe: Subscription (VB6 to C#) Pin
BobJanova20-May-11 6:47
BobJanova20-May-11 6:47 
QuestionWorking with OleDb and Null Values Pin
Matt U.18-May-11 13:28
Matt U.18-May-11 13:28 
AnswerRe: Working with OleDb and Null Values Pin
PIEBALDconsult18-May-11 14:30
mvePIEBALDconsult18-May-11 14:30 
GeneralRe: Working with OleDb and Null Values Pin
Matt U.18-May-11 14:48
Matt U.18-May-11 14:48 
QuestionRe: Working with OleDb and Null Values Pin
Luc Pattyn18-May-11 16:47
sitebuilderLuc Pattyn18-May-11 16:47 
AnswerRe: Working with OleDb and Null Values [modified] Pin
PIEBALDconsult18-May-11 16:59
mvePIEBALDconsult18-May-11 16:59 
GeneralRe: Working with OleDb and Null Values Pin
Luc Pattyn18-May-11 17:11
sitebuilderLuc Pattyn18-May-11 17:11 
GeneralRe: Working with OleDb and Null Values Pin
PIEBALDconsult18-May-11 17:29
mvePIEBALDconsult18-May-11 17:29 
GeneralRe: Working with OleDb and Null Values Pin
GenJerDan19-May-11 11:13
GenJerDan19-May-11 11:13 
AnswerRe: Working with OleDb and Null Values Pin
Shameel19-May-11 1:42
professionalShameel19-May-11 1:42 
AnswerRe: Working with OleDb and Null Values Pin
Pete O'Hanlon19-May-11 2:09
mvePete O'Hanlon19-May-11 2:09 
GeneralRe: Working with OleDb and Null Values Pin
Luc Pattyn19-May-11 3:11
sitebuilderLuc Pattyn19-May-11 3:11 
GeneralRe: Working with OleDb and Null Values Pin
Pete O'Hanlon19-May-11 3:31
mvePete O'Hanlon19-May-11 3:31 
QuestionCombo+GroupBox Pin
KORCARI18-May-11 9:35
KORCARI18-May-11 9:35 
AnswerRe: Combo+GroupBox Pin
Expert Coming18-May-11 10:38
Expert Coming18-May-11 10:38 
AnswerRe: Combo+GroupBox Pin
RobCroll19-May-11 6:19
RobCroll19-May-11 6:19 
QuestionCall a function of other form [modified] Pin
MiguelSanchezCuarental18-May-11 5:03
MiguelSanchezCuarental18-May-11 5:03 
AnswerRe: Call a function of other form Pin
Wayne Gaylard18-May-11 5:47
professionalWayne Gaylard18-May-11 5:47 
For a simple excercise, you could create a form level variable in form2 that holds a reference to form1. Then in form2 you can just call the function like this

C#
public Form1()
       {
           InitializeComponent();
       }

       public void Hello(string name)
       {
           MessageBox.Show(string.Format("Hello, {0}", name)
       }


C#
public partial class Form2 : Form
    {
        Form1 form1;

        public Form2()
        {
            InitializeComponent();
            form1 = new Form1();
        }

        private void Form2_Load(object sender, EventArgs e)
        {
            form1.Hello("Wayne");
        }
    }


As a simple excercise, this is fine, but in a production app you would want to look into creating a Mediator class to communicate between classes, so that the entities have no need of any knowledge of each other.
...and I have extensive experience writing computer code, including OIC, BTW, BRB, IMHO, LMAO, ROFL, TTYL.....

AnswerRe: Call a function of other form Pin
Icharus18-May-11 5:51
Icharus18-May-11 5:51 
AnswerRe: Call a function of other form Pin
DaveyM6918-May-11 9:30
professionalDaveyM6918-May-11 9:30 

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.