common panel on 2 forms

  • Thread starter Thread starter NM
  • Start date Start date
N

NM

Hi,

In my project, I have 2 forms; both have a common panel (with combobox,
textbox, labels, methods, ...).
Is it possible to create that compoment separetly and then add it to the 2
forms?
If yes, how?

Thanks in advance;
 
NM,

Just create your own inherited panel from that.

To di ut us just Add new> item> user control and than change in the code of
that the toprow "usercontrol" for the control you want to inherit in this
case panel. and go on. It is very easy to do when you know how.

I hope this helps?

Cor

Hi,
 
* "NM said:
In my project, I have 2 forms; both have a common panel (with combobox,
textbox, labels, methods, ...).
Is it possible to create that compoment separetly and then add it to the 2
forms?

"Project" -> "Add UserConntrol...".
 
Thanks Cor,

But the common panel isn't at the same position on the 2 forms and haven't
the same size on both of them;
So my forms can't inherit the panel;
 
The problem with the UserControl is that I have created it with one
constructor that take an object on parameter.
I get an error with VS when I was trying to use it.
 
* "NM said:
The problem with the UserControl is that I have created it with one
constructor that take an object on parameter.
I get an error with VS when I was trying to use it.

Then use a property instead of passing the value to the ctor, for
example.
 
I need to pass the value by reference and that's not possible with property;
 
NM said:
I need to pass the value by reference and that's not possible with property;

Most values are actually "by reference", depending on your definition. What
is the type of your value?

Best Regards,

Andy
 
It's a class that I create.
I tried to modify byval by byref in the set property definition, and VS
generate an error
 
NM said:
It's a class that I create.
I tried to modify byval by byref in the set property definition, and VS
generate an error

Let me back up then. How do you know you need to change to ByRef - what is
it you are not able to do using ByVal?

Best Regards,

Andy
 
Let me back up then. How do you know you need to change to ByRef ?
Because I need to modify some object's attributes;
- what is it you are not able to do using ByVal?
The question is not what I'm not able to do using Byval;
It's : what I don't want to do if I use Byval?
And the answer is :
1) save memory (1 object instead of 2)
2) no need to update the original object by the copy after modifications

Best Regards,

Andy

Thanks to all and best regards;
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top