473,397 Members | 2,116 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,397 software developers and data experts.

A form within a form in 2005

I have three forms in my application; frmMain being the main form:
frmMain containing two button; btnDisplayForm1 and btnDisplayForm2
FormA containing a button btnProcessRequestA
FormB containing a button btnProcessRequestB

frmMian is displayed and the FormB is displayed inside frmMain using
SetParent; I click on btnDisplayForm1 which fires up the following code:
FormA frm = new FormA ();
Button btn = frm.btnProcessRequestA;
this.InvokeOnClick(btn, EventArgs.Empty);

When btnProcessRequestA is fired up on FormA; it displays FormB.

How do I display FormB inside frmMian?
Aug 6 '08 #1
6 1097
I have tried the following code but got the error: {"Unable to find an entry
point named 'SetParent' in DLL 'gdi32.dll'.":""}

FormB formB = new FormB();
frmMain fMain = new frmMain
SetParent(formB.Handle, fMain.Handle);
formB.Show();


"Ryan" wrote:
I have three forms in my application; frmMain being the main form:
frmMain containing two button; btnDisplayForm1 and btnDisplayForm2
FormA containing a button btnProcessRequestA
FormB containing a button btnProcessRequestB

frmMian is displayed and the FormB is displayed inside frmMain using
SetParent; I click on btnDisplayForm1 which fires up the following code:
FormA frm = new FormA ();
Button btn = frm.btnProcessRequestA;
this.InvokeOnClick(btn, EventArgs.Empty);

When btnProcessRequestA is fired up on FormA; it displays FormB.

How do I display FormB inside frmMian?
Aug 6 '08 #2
On Aug 6, 12:17 pm, Ryan <R...@discussions.microsoft.comwrote:
I have three forms in my application; frmMain being the main form:
frmMain containing two button; btnDisplayForm1 and btnDisplayForm2
FormA containing a button btnProcessRequestA
FormB containing a button btnProcessRequestB

frmMian is displayed and the FormB is displayed inside frmMain using
SetParent; I click on btnDisplayForm1 which fires up the following code:
FormA frm = new FormA ();
Button btn = frm.btnProcessRequestA;
this.InvokeOnClick(btn, EventArgs.Empty);

When btnProcessRequestA is fired up on FormA; it displays FormB.

How do I display FormB inside frmMian?
why you do that?
why not use a Panel instead of a form?
Aug 6 '08 #3
It has to be a form for what I am trying to accomplish.

"Ignacio Machin ( .NET/ C# MVP )" wrote:
On Aug 6, 12:17 pm, Ryan <R...@discussions.microsoft.comwrote:
I have three forms in my application; frmMain being the main form:
frmMain containing two button; btnDisplayForm1 and btnDisplayForm2
FormA containing a button btnProcessRequestA
FormB containing a button btnProcessRequestB

frmMian is displayed and the FormB is displayed inside frmMain using
SetParent; I click on btnDisplayForm1 which fires up the following code:
FormA frm = new FormA ();
Button btn = frm.btnProcessRequestA;
this.InvokeOnClick(btn, EventArgs.Empty);

When btnProcessRequestA is fired up on FormA; it displays FormB.

How do I display FormB inside frmMian?

why you do that?
why not use a Panel instead of a form?
Aug 6 '08 #4
Ignacio,
If I go with your suggestion and use a panel to display FormA and FormB; how
do I pass values between these two forms?

If I use the code:
FormA frm = new FormA();
Button btn = frm.button1;
this.InvokeOnClick(btn, EventArgs.Empty);

the button click event is invoked but the form is displayed outside the
panel and the values aren't passed to FormB. The code for the FormB is:
Form3 frm = new Form3();
frm._textBox1 = _textBox1;
frm.Show();

I need to toggle between two forms and pass value between them.

Thanks
"Ryan" wrote:
It has to be a form for what I am trying to accomplish.

"Ignacio Machin ( .NET/ C# MVP )" wrote:
On Aug 6, 12:17 pm, Ryan <R...@discussions.microsoft.comwrote:
I have three forms in my application; frmMain being the main form:
frmMain containing two button; btnDisplayForm1 and btnDisplayForm2
FormA containing a button btnProcessRequestA
FormB containing a button btnProcessRequestB
>
frmMian is displayed and the FormB is displayed inside frmMain using
SetParent; I click on btnDisplayForm1 which fires up the following code:
FormA frm = new FormA ();
Button btn = frm.btnProcessRequestA;
this.InvokeOnClick(btn, EventArgs.Empty);
>
When btnProcessRequestA is fired up on FormA; it displays FormB.
>
How do I display FormB inside frmMian?
why you do that?
why not use a Panel instead of a form?
Aug 6 '08 #5
On Aug 6, 7:20*pm, Ryan <R...@discussions.microsoft.comwrote:
Ignacio,
If I go with your suggestion and use a panel to display FormA and FormB; how
do I pass values between these two forms? *
See it like this, instead of using form use a control , so you have
two controls ControlA & ControlB hosted in the same form. how do you
pass values between then depends if either ControlA or ControlB knows
about the other.
In a templated solution you will have methods in the container
(Form1) that detect thte changes in ControlA and then call the method
in ControlB

hope that it's clear for you. if not post back
Aug 7 '08 #6
Could you please privde a sample code???

"Ignacio Machin ( .NET/ C# MVP )" wrote:
On Aug 6, 7:20 pm, Ryan <R...@discussions.microsoft.comwrote:
Ignacio,
If I go with your suggestion and use a panel to display FormA and FormB; how
do I pass values between these two forms?

See it like this, instead of using form use a control , so you have
two controls ControlA & ControlB hosted in the same form. how do you
pass values between then depends if either ControlA or ControlB knows
about the other.
In a templated solution you will have methods in the container
(Form1) that detect thte changes in ControlA and then call the method
in ControlB

hope that it's clear for you. if not post back
Aug 7 '08 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: David White | last post by:
Hello everyone, I'm new to access, so if this is a dumb question I apologize in advance. I created a query that requires a "parameter value" to be entered. I then created a form to display...
7
by: Tom wilson | last post by:
I'm trying to create dynamic controls in ASP.Net. It's driving me nuts. I keep getting the error: Control '16' of type 'RadioButton' must be placed inside a form tag with runat=server. Dim...
2
by: Neo Geshel | last post by:
After pouring over about a dozen sites that clearly dealt with ClientID all by itself, I came to the realization that about 2/3+ of them were doing it wrong. It is indeed impossible to grab the...
4
by: Tull Clancey | last post by:
I have a class that inherits a form. How can I handle clicks and changes to controls on the inherited form within my class? Cheers, Tull.
3
by: EnglishMan69 | last post by:
Hello All, I am using VB2005 Beta 2 in VS 2005 and am running into a small problem. I need to be able to add a picture box to the main form from within a thread. The program goes to a web...
2
by: jasonhartsoe | last post by:
I'm using Visual Studio 2005 Team Edition....using visual basic. I'm trying to use the webbrowser control. In the webbrowser control I have it got to a page where there is a form. It waits for...
2
by: Mike Baugh | last post by:
I am using visual studio 2005 to develop a form using c# I have 3 datagrids on one form. I can set the row color based on a certain value in a column. However this color applies to all 3...
5
by: Miro | last post by:
I will try my best to ask this question correctly. I think in the end the code will make more sence of what I am trying to accomplish. I am just not sure of what to search for on the net. I...
6
by: Goran Djuranovic | last post by:
Hi all, I have a VB.NET windows application that uses MDI form. When I try to delete a datagrid row from one of the MDI children forms, I use a MessageBox YesNo confirmation, which, after confirmed,...
5
by: BD | last post by:
I am coding with C# in Visual Studio 2005 for a database application residing on remote MS SQL Server 2005. What I want to do is open the same form but from 2 different places and only one...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.