Re-using same Buttons, TextBox, Combobox in different forms

Joined
Aug 28, 2008
Messages
13
Programming Experience
Beginner
Hi friends
Here i came up with a problems. May b its silly but I dont know how to.
I am creatting an windows application software in which many controls like Buttons, textBox, combobox are remain same in 12 different form. In this 12 diff form the activity of those controls will remain same.
I think I shud explain a lil more.
The scenareo id
1. I have 12 forms.
2. Each form containing 3 labels (Country, State, City). These labels indicates 3 combobox from which we can select location.
3. Now I need to use these 3 controls in all 12 forms with same activity.
4. When I change forms to another, these buttons shud remain same.

I am doing this software by C#. No probs if you ans by VB.NET code.

Can Any one help me please.

Thanks:)
 
Create a form that has just those controls, then have the 12 forms inherit from the base form you just created

A form is a class like everything else in .Net, you can do inheritance with them just as easily
 
Thanks a lot for replying so fast.

I have done it just now but All components are locked.
How can I use other new controls here??

Thanks

:)
 
Last edited:
The ones in the base form are locked, you can add other controls to the form as you normally would
 
The "lock" depends on the access level for those controls, it is controlled with the Modifiers property, try it out.
 
Thanks a lot ppl
JuggaloBrotha By your advice I have created n its work fine

Now I have another question.
Scenario:
1. I have created a Base form. And inherit it from many forms.
2. Now I have added many other controls on the other forms.
3. When I call single form which is created by using Inherit form from Base form and some new controls, the base form also called at the same times. Right !

Let me explain detail,

There has 3 forms
1.Frm_BaseForm.
2.Frm_Student. (Inherit from Frm_BaseForm).
3.Frm_Teacher. (Inherit from Frm_BaseForm).

Assume that Frm_Student is loaded. Now Can the Frm_BaseForm catch which form is loaded?

plz reply
Thanks
 
Can the Frm_BaseForm catch which form is loaded?
Yes, Me keyword returns current instance. You'll most likely be comparing types so you use the GetType method of the instance to get the Type.
 
Back
Top