[Migrated content. Thread originally posted on 19 April 2011]
How I can move from one windows form to another with Visual Cobol?. And how I can create those on my project and I can Hide and Un-Hide?. Please let me know where I can find one example. My email is: jose61@pryma.ws[Migrated content. Thread originally posted on 19 April 2011]
How I can move from one windows form to another with Visual Cobol?. And how I can create those on my project and I can Hide and Un-Hide?. Please let me know where I can find one example. My email is: jose61@pryma.wsThe code for the main form is shown below:
Let me know if you need anything else.
*-------------------------------------------------------------------------*
* MultiForms Demo *
* *
* This example demonstrates how multiple Windows forms can be used within*
* a .NET WinForm application. *
* *
* The main form Form1 is created in main.cbl. Form1 contains a number of *
* button controls which allow you to create two additional forms called *
* Form2 and Form3. Once these forms are created you can click additional *
* buttons to control whether they should be hidden or shown. *
* *
* An event handler is added to Form1 in order to capture the FormClosed *
* event for both Form2 and Form3 so that Form1 can enable and disable the*
* correct buttons to allow for a new instance of Form2 or Form3 to be *
* created. The FormClose event is triggered by clicking on the Close Form*
* button on Form2 or Form3. *
*-------------------------------------------------------------------------*
class-id MultiFormsDemo.Form1 is partial
inherits type System.Windows.Forms.Form.
working-storage section.
01 Form2 type MultiFormsDemo.Form2.
01 Form3 type MultiFormsDemo.Form3.
method-id NEW.
procedure division.
invoke self::InitializeComponent
goback.
end method.
method-id btnCreate2_Click final private.
procedure division using by value sender as object e as type System.EventArgs.
set Form2 to new type MultiFormsDemo.Form2
*> The following adds an event handler to this form which will catch the FormClosed event on Form2
invoke Form2::add_FormClosed(new System.Windows.Forms.FormClosedEventHandler(self::Form2_Closed))
invoke Form2::Show
*> Disable the Create Form2 button so only one instance of Form2 will be created.
set self::btnCreate2::Enabled to false
set self::btnHide2::Enabled to true
set self::btnShow2::Enabled to true
end method.
method-id btnCreate3_Click final private.
procedure division using by value sender as object e as type System.EventArgs.
set Form3 to new type MultiFormsDemo.Form3
*> The following adds an event handler to this form which will catch the FormClosed event on Form3
invoke Form3::add_FormClosed(new System.Windows.Forms.FormClosedEventHandler(self::Form3_Closed))
invoke Form3::Show
*> Disable the Create Form3 button so only one instance of Form3 will be created.
set self::btnCreate3::Enabled to false
set self::btnHide3::Enabled to true
set self::btnShow3::Enabled to true
end method.
method-id btnHide2_Click final private.
procedure division using by value sender as object e as type System.EventArgs.
invoke Form2::Hide
end method.
method-id btnHide3_Click final private.
procedure division using by value sender as object e as type System.EventArgs.
invoke Form3::Hide
end method.
method-id btnShow2_Click final private.
procedure division using by value sender as object e as type System.EventArgs.
invoke Form2::Show
end method.
method-id btnShow3_Click final private.
procedure division using by value sender as object e as type System.EventArgs.
invoke Form3::Show
end method.
method-id Form1_Load final private.
procedure division using by value sender as object e as type System.EventArgs.
*> set the initial state of the buttons.
set self::btnCreate2::Enabled to true
set self::btnHide2::Enabled to false
set self::btnShow2::Enabled to false
set self::btnCreate3::Enabled to true
set self::btnHide3::Enabled to false
set self::btnShow3::Enabled to false
end method.
*> The following event handler will be triggered when the Close Form2 button is clicked in Form2
method-id Form2_Closed.
procedure division using by value sender as object e as type System.Windows.Forms.FormClosedEventArgs.
set self::btnCreate2::Enabled to true
set self::btnHide2::Enabled to false
set self::btnShow2::Enabled to false
end method.
*> The following event handler will be triggered when the Close Form3 button is clicked in Form3
method-id Form3_Closed.
procedure division using by value sender as object e as type System.Windows.Forms.FormClosedEventArgs.
set self::btnCreate3::Enabled to true
set self::btnHide3::Enabled to false
set self::btnShow3::Enabled to false
end method.
method-id button1_Click final private.
procedure division using by value sender as object e as type System.EventArgs.
invoke self::Close
end method.
end class.
[Migrated content. Thread originally posted on 19 April 2011]
How I can move from one windows form to another with Visual Cobol?. And how I can create those on my project and I can Hide and Un-Hide?. Please let me know where I can find one example. My email is: jose61@pryma.wsFor anyone else that would like to get a copy of this demo, I have made it available in the articles section of this Community web site.
How to handle multiple forms in a .NET Windows Forms Application
[Migrated content. Thread originally posted on 19 April 2011]
How I can move from one windows form to another with Visual Cobol?. And how I can create those on my project and I can Hide and Un-Hide?. Please let me know where I can find one example. My email is: jose61@pryma.wsThat works, but now how I can Hide de first, when I open the second?
[Migrated content. Thread originally posted on 19 April 2011]
How I can move from one windows form to another with Visual Cobol?. And how I can create those on my project and I can Hide and Un-Hide?. Please let me know where I can find one example. My email is: jose61@pryma.wsThat works, but now how I can Hide de first, when I open the second?
[Migrated content. Thread originally posted on 19 April 2011]
How I can move from one windows form to another with Visual Cobol?. And how I can create those on my project and I can Hide and Un-Hide?. Please let me know where I can find one example. My email is: jose61@pryma.wsThis form can be hidden by issuing:
invoke self::Hide
after the invoke Form2::Show is issued.
The form will still be active however, it just will not be displayed.
It can be reactivated by doing an invoke self::Show on it.
If you wish for Form2 to replace Form1 as the main program then the control program should not be Form1 it should be in main.cbl.
Maybe if you can give me some more details on how you wish your application to work then I can give you an example that more closely resembles what you are trying to accomplish?
Thanks.
[Migrated content. Thread originally posted on 19 April 2011]
How I can move from one windows form to another with Visual Cobol?. And how I can create those on my project and I can Hide and Un-Hide?. Please let me know where I can find one example. My email is: jose61@pryma.ws[Migrated content. Thread originally posted on 19 April 2011]
How I can move from one windows form to another with Visual Cobol?. And how I can create those on my project and I can Hide and Un-Hide?. Please let me know where I can find one example. My email is: jose61@pryma.ws[Migrated content. Thread originally posted on 19 April 2011]
How I can move from one windows form to another with Visual Cobol?. And how I can create those on my project and I can Hide and Un-Hide?. Please let me know where I can find one example. My email is: jose61@pryma.wsI have e-mailed you another example program which uses multiple forms in a Windows Forms application.
This is really a .zip file but I had to rename it in order for our e-mail provider to allow it as an attachment.
Rename the .doc to .zip when you download it.
This one uses an ApplicationContext class to control the displaying of multiple forms in an application.
I modified the main.cbl to invoke the Application::Run method to use the ApplicationContext instance instead of displaying a form automatically.
The ApplicationContext class creates event handlers for the closing of the other forms so it knows when to close the application.
Demo now does the following:
1. Displays the LoginForm
2. If Login is OK it closes LoginForm and displays Form1
3. Form1 has a menu. If Test menu item selected TestForm will be displayed as Modal.
4. Exiting TestForm will return to Form1
5. When Form1 is closed Application will exit.
There are many different ways to accomplish this same thing, this is only one example.
You should read up on the System.Windows.Forms class and System.Windows.Forms.Application class for more information and examples of how to work with Windows Forms applications.
Let me know if you have any questions.
[Migrated content. Thread originally posted on 19 April 2011]
How I can move from one windows form to another with Visual Cobol?. And how I can create those on my project and I can Hide and Un-Hide?. Please let me know where I can find one example. My email is: jose61@pryma.wsI'd downloaded this demo and aplied this to my aplication and works. I did another post, how add items to ComboBox.
Sincerely
Manuel.
[Migrated content. Thread originally posted on 19 April 2011]
How I can move from one windows form to another with Visual Cobol?. And how I can create those on my project and I can Hide and Un-Hide?. Please let me know where I can find one example. My email is: jose61@pryma.ws[Migrated content. Thread originally posted on 19 April 2011]
How I can move from one windows form to another with Visual Cobol?. And how I can create those on my project and I can Hide and Un-Hide?. Please let me know where I can find one example. My email is: jose61@pryma.wsWhen I click on the link, it says the webpage no longer exists.
[Migrated content. Thread originally posted on 19 April 2011]
How I can move from one windows form to another with Visual Cobol?. And how I can create those on my project and I can Hide and Un-Hide?. Please let me know where I can find one example. My email is: jose61@pryma.wsHello Austin1,
Please try the following link.
[Migrated content. Thread originally posted on 19 April 2011]
How I can move from one windows form to another with Visual Cobol?. And how I can create those on my project and I can Hide and Un-Hide?. Please let me know where I can find one example. My email is: jose61@pryma.wsThanks!
Austin
Sign up
Already have an account? Login
Welcome to the Rocket Forum!
Please log in or register:
Employee Login | Registration Member Login | RegistrationEnter your E-mail address. We'll send you an e-mail with instructions to reset your password.