Click here to Skip to main content
15,891,981 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

i've got a main form. It's an MDI Parent. In this parent i'm opening a second form and and i'm using a class.

Looks like this:

C#
public partial class Main : Form
    {
     Serial serialPort = new Serial();
[...].     Util childForm = new Util();
[...].     childForm.Show();


this works fine. I can start the childForm and work with the serialPort in my Main form.

Now i want to use the methodes from my Serial class in the opened childForm. How can i do this without the existing serialPort in the Main form?
Posted

You'll need to pass a reference to the Serial class to the child form obviously. :rolleyes:

Create a overloaded constructor and pass it in or create a property and set it.
 
Share this answer
 
Is it possible, that you give me an example, cuz i can't find any article. May i search with the wrong keywords. :doh:
 
Share this answer
 
Comments
Henry Minute 21-May-10 8:43am    
Try 'c# passing parameters from one form to another' as a search phrase.
diialer 23-May-10 14:35pm    
thank you very much, found some usefull examples

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900