CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6

Hybrid View

  1. #1
    Join Date
    Jun 2012
    Posts
    37

    Question Working with more than one form?

    Hi There, how are you?

    I'm currently trying to work with more than one form, but I didn't succeed yet. What I need is quite simple: Once the program runs, a small form appears first asking "what would you like to do" with corresponding buttons for each option. Each button loads a new different form for a different task. So basically I need to open and close forms, also having two forms loaded at the same time (pop-up style) would be great for certain purposes.

    I know it may sound simple, but although I've searched already, I still haven't figured how to do it properly. I'm currently using VC++ 2008 and my project is a Windows Forms Application. Any help will be greatly appreciated!

    Thanks a lot!

  2. #2
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,395

    Re: Working with more than one form?

    Windows Forms Application problems are discussed in the appropriate Forums like:
    Managed C++ and C++/CLI
    or some of the .NET Programming one
    Victor Nijegorodov

  3. #3
    Join Date
    Apr 2012
    Posts
    29

    Re: Working with more than one form?

    Code:
    //Leave this in your event handle
    FormClass x=new FormClass();
    x.Show();

  4. #4
    Join Date
    Jun 2012
    Posts
    37

    Re: Working with more than one form?

    Ok, one step at a time. My biggest problem is that I can't find a way to make the form RETURN a value when it closes.

    My idea is that depending on what the user chooses at the first form, it returns an specific value. For example, Form 1 has button1, button2 and button3. If uses clicks button2, it closes and returns 2.

    Sounds simple but I've been having a hell of a hard time trying to figure it out! Any ideas?

    Thanks!!

  5. #5
    Join Date
    Jun 2010
    Location
    Germany
    Posts
    2,675

    Re: Working with more than one form?

    To add to what VictorN posted, this is the link to the correct forum section: http://forums.codeguru.com/forumdisp...ed-C-and-C-CLI

    Quote Originally Posted by fernando306 View Post
    Ok, one step at a time. My biggest problem is that I can't find a way to make the form RETURN a value when it closes.

    [...]

    Sounds simple but I've been having a hell of a hard time trying to figure it out! Any ideas?
    Given that description, there are several potential approaches, which one being best fit depending on specifics of the concrete scenario that are yet unknown. Discussing that here would certainly be too off-topic. So please repost your question in the appropriate forum section (see above) unless a moderator already has moved this thread over there by the time you read this.

    Quote Originally Posted by thefollower View Post
    Code:
    //Leave this in your event handle
    FormClass x=new FormClass();
    x.Show();
    That's C#.
    I was thrown out of college for cheating on the metaphysics exam; I looked into the soul of the boy sitting next to me.

    This is a snakeskin jacket! And for me it's a symbol of my individuality, and my belief... in personal freedom.

  6. #6
    Join Date
    Jun 2012
    Posts
    37

    Re: Working with more than one form?

    I am really sorry, I'm new here and I'm a little lost with all these forum sections. As you advised me, I opened a new thread here:

    http://forums.codeguru.com/showthrea...53#post2086653

    Thank you! I look forward to your input.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured