Thread: Form problems

  1. #1
    Registered User
    Join Date
    Sep 2001
    Posts
    173

    Form problems

    Hi:
    if I have one button on the form, and another form apprears after clicking the button, but if i keep clicking the button, the number of 2nd form would exist as many as I click.
    so is there any way or property to make me no matter how many times I click, there is only one 2nd form.

    thank you
    Don't laugh at me,I am just a SuperNewbie.

  2. #2
    the hat of redundancy hat nvoigt's Avatar
    Join Date
    Aug 2001
    Location
    Hannover, Germany
    Posts
    3,130
    The form2 variable should be a variable of form1. Only create a new form, if it is null. Else make the form2 visible.
    hth
    -nv

    She was so Blonde, she spent 20 minutes looking at the orange juice can because it said "Concentrate."

    When in doubt, read the FAQ.
    Then ask a smart question.

  3. #3
    Registered User
    Join Date
    Sep 2001
    Posts
    173
    Sorry, I didn't understand what you mean, can you make a simple example.
    thank you
    Don't laugh at me,I am just a SuperNewbie.

  4. #4
    the hat of redundancy hat nvoigt's Avatar
    Join Date
    Aug 2001
    Location
    Hannover, Germany
    Posts
    3,130
    class Form1
    {
    private Form2 f = null;
    ...

    in button click event:

    if( f == null )
    {
    f = new Form2();
    }

    Form2.Visible=true;






    Don't you think making Form2 modal would be better ? Do you actually need to keep both Windows open ?
    hth
    -nv

    She was so Blonde, she spent 20 minutes looking at the orange juice can because it said "Concentrate."

    When in doubt, read the FAQ.
    Then ask a smart question.

  5. #5
    Registered User
    Join Date
    Sep 2001
    Posts
    173
    Yes, I am using Modal, but if there are around 10 forms interacting each other, that would be a problem,
    Thank you for your code.
    Don't laugh at me,I am just a SuperNewbie.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Form processing : storing strings in arrays
    By D.A.C in forum C Programming
    Replies: 5
    Last Post: 08-17-2003, 05:44 PM
  2. know where the form it was closed from
    By talal*c in forum Windows Programming
    Replies: 3
    Last Post: 11-09-2002, 08:45 PM
  3. long form of year to short form?
    By bc120 in forum C Programming
    Replies: 2
    Last Post: 12-31-2001, 05:34 PM
  4. Help with a bit of tweeking on form feed
    By breed in forum C Programming
    Replies: 5
    Last Post: 11-27-2001, 06:45 AM
  5. Recording Data sent to program by Form
    By No1 in forum C++ Programming
    Replies: 2
    Last Post: 09-28-2001, 07:46 PM