|
Hi,
i guess you have to use an event in form1 that invokes a methode on your mainform.
in this methode you can create your second form.
another way is making the mainform available in the form1. for example override the contructor of form1 with extra parameter that makes the mainform available as owner object.
i prefer the first solution
greetz
Kurt
|
|
|
|
|
hi
thanks again
i hav create these form already
only the issue is to call form2 in the mdiForm
i hav used this
on the load event of mdiForm
i hav made the form1 and form2 its child with following code:
form1 objForm1 = new form1();
objForm1.mdiParent = this;
form2 objForm2 = new form2();
objForm2.mdiParent = this;
then on click event of button in mdiForm form1 is opening in mdiForm
but when i tried to open form2 on the click event on button in form1
then it opening as new form not as Child form.
REGARDS
rahul saini
|
|
|
|
|
Your form declaration should be in the class, not in the onload.
but probably you have declared a new variable form2 in your form1
make an event in form1.. wich is called in your buttonClick.
public delegate void OnCreateForm2()
public event OnCreateForm2 OnCreateForm2Event
in the buttonclick call the event
if (OnCreateForm2Event != null)
OnCreateForm2Event()
assign the event in your mainform where you created it.
objForm1 = new form1();
objForm1.mdiParent = this;
objForm1.OnCreateForm2Event += OnCreateform2eventinMain
OnCreateform2eventinMain is a method in your mainform where you put the code
public void OnCreateform2eventinMain()
{
objForm2 = new form2();
objForm2.mdiParent = this;
}
this should do...
greetz
kurt
|
|
|
|
|
the coding is incorrect.
because u need to create an object of child form(form 2) in form 1(parent form of form 2).
but u have created an object for form1 itself which is the parent form.
u write the following coding in the button click event of form1:
form2 obj=new form2();
form2.MdiParent=this;
form2.show();
NOTE:
do make sure that a parent form cannot be a child form of another parent form.ie.,form1 cannot be a child form for another parent form.
am i making sense????
if yes,
do send ur feedback r comments to my mail id.
my id is vignesh_ravi23@yahoo.com
happy programming!
vignesh ravikumar
|
|
|
|
|
in what scenario we will go for abstract and interface
plz let me know
with regards
ravi
|
|
|
|
|
|
Interface :
(1) For supporting the mutiple inheritence
(2) For initialize runtime objects
(3) For implementing group of methos
Abstract Class :
When you maintain the Base lass standard, You can use Abstract class.
-- modified at 6:53 Friday 16th February, 2007
Parwej Back...............DON of Developer.......
Parwej Ahamad
g_parwez@rediffmail.com
|
|
|
|
|
Parwej Ahamad wrote: 1) For supporting the mutiple inheritence
No, .NET does not support MI. We use interfaces to support polymorphism.
|
|
|
|
|
Dear i know .Net does not support multiple inheritence but u can implement mutiple inheritence with the help of Interface
Parwej Back...............DON of Developer.......
Parwej Ahamad
g_parwez@rediffmail.com
|
|
|
|
|
Parwej Ahamad wrote: but u can implement mutiple inheritence with the help of Interface
No, you can't. You're thinking that "multiple inheritance" is the same as "multiple interfaces". It is not. Multiple interfaces are a synonym of something called "polymorphism", but polymorphism is a mere requirement for multiple inheritance, which does a lot more than polymorphism.
|
|
|
|
|
|
Difference between Abstract classes and Interface
Little background:
A real world entity is represented in an OOP world as object. Objects are defined as classes any language.
A class defines objects in two aspects
Object's characteristics - Data Members
Object's functionality - Member functions
So, when the classes that are forced to provide implementations of the functions prototypes that are defined in either ‘interfaces’ or a ‘abstract class’ are not belonging to the same family (having some inherited parental characteristics from same parent directly or indirectly) but are rather related through some functionalities then 100% we will go with interface and if above said classes are belonging to same family then we should go with abstract class inheritance.
Also in case of inheritance as everything is a specialization of base parent object so there is allowance of providing some default definitions of the functions that are needed to be implemented further by specialized classes. This is not any way allowed in interfaces because implementing classes are not belonging to same family and are not any way related by characteristics.
An Example:
We have four real world objects:
• Airplane
• Bird
• Sparrow
• Eagle
We have one method that is a functionality of all above objects
• Fly
Now all objects share common functionality flying in air but differ in the mechanism they use to fly.
Also by close look we see that in general there is some common characteristics (as well as some common functionalities) between Sparrow and Eagle that can be a part of common class Bird (that has to be abstract because there is no real thing like bird!). But any way Airplane can't be related to Bird or its specialized classes Sparrow and Eagle.
So if want to expose fly functionality to outer world and want their implementations in Airplane and Sparrow (or any bird), so I will 100% go for Interface and Abstract classes will be a big NO!
But if we exclude Airplane want that fly functionality is exposed to outer world and its implementing classes are Bird, Sparrow and Eagle then 'Abstract Classes' is the best of best choice.
Happy programming! Please feel free in writing to me for further clarifications on other OOP concepts (im.himanshu2006@gmail.com)
Himanshu
|
|
|
|
|
Hi all
I created a thead and textbox in a class and try to set value of textbox from another created thread.
But error comes that Resources held by main thread as TextBoxes are held by main thread. What to do in this case?
#Abhi#
|
|
|
|
|
Take a look at this article here on CP: What's up with BeginInvoke?[^]
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook www.troschuetz.de
|
|
|
|
|
Only the main thread can update an item on a form.
|
|
|
|
|
Hi,
in .NET 1.x you could try it from another thread and it might work (most of the time),
or it could result in forms with a white menu bar on top (I'm sure you have seen these
already, even on non-.NET code).
in .NET 2.0 and up it gets rejected by default; you must set it up in such a way that
all controls get handled completely by the thread that created them, often called "the UI
thread" or "the main thread".
For some simple examples, look at either one of my articles.
Luc Pattyn
|
|
|
|
|
I need to Mime encode a jpeg to stick it in a database that is normally used by an ASP app so it stores the MimeType and MimeString. I'm writing a winforms app. Everything I've found so far encodes into a mailmessage or http stream but I can't see a way of getting the data back out
Any help would be greatly appreciated.
Thanks,
Russell
|
|
|
|
|
i wnat now whether javascript can be used by asp controls
or not
i have many validations to be done on client side and need to carry them to cs file what should i do....
for this
thanking u
|
|
|
|
|
use the attribute Runat = Server in all the controls if you want to carry them to CS file.
Regards,
Sylvester G
Senior Software Engineer
Xoriant Solutions
sylvester_g_m@yahoo.com
|
|
|
|
|
thanks a lot dude....
bye
|
|
|
|
|
I am facing a very rigid problem. Project requirement is to integrate NUNIT with Crystal Reports and then write NUNIT Test cases for each Crystal reports designed... Please help me in integrating NUNIT with Crystal Reports And afterwards in writing NUNITs for the same
Harshal M Nemade
|
|
|
|
|
Hello,
Is there a way to detect that the pc monitor is going in standby mode in C# 2.0 with windows XP.
I have tried to detect WM_POWERBROADCAST and registerPowerNotifications (Vista only feature so it didn't work). Thanks for any suggestions .
|
|
|
|
|
When I was at the Detroit launch event in the developer track, the presenters said that their was no way to tell of different power setting changes in Windows XP. They did however mention the WM_POWERBROADCAST event for Windows Vista and how it could be used within gadgets/applications.
Regards,
Thomas Stockwell
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.
Visit my homepage Oracle Studios[ ^]
|
|
|
|
|
We need to validate an expression which contains all the arithematic operators, conditional operators, logical operators, grouping such as '()' and '{}'
For example:
A+B = 10 AND (B*C)/d = 56
Thanks in advance
|
|
|
|
|
This sounds very much like homework to me, but I might be wrong...
Internet - the worlds biggest dictionary
|
|
|
|