Results 1 to 14 of 14

Thread: Opening a new form

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Jul 2004
    Posts
    235

    Thumbs up Opening a new form

    Got a problem here.

    Dim cf2 As New CrossfireForm2

    If (DatePicker1.Value() > Now()) Then
    cf2.Show()
    End If

    Problem is that when cf2 is called, cf1 which is form1 will still be active... How to make cf1 inactive.

    Also I tried using .ShowDialog() , error compiling....

  2. #2
    Fanatic Member brown monkey's Avatar
    Join Date
    Jun 2004
    Location
    Cebu
    Posts
    552
    is this generates error upon compiling?
    VB Code:
    1. cf2.showdialog()

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Jul 2004
    Posts
    235
    yes, this the error of compliation....

  4. #4
    Fanatic Member brown monkey's Avatar
    Join Date
    Jun 2004
    Location
    Cebu
    Posts
    552
    i don't get any. what does the error say?
    VB Code:
    1. dim f as new form2
    2. f.showdialog() 'woks fine in my [time, lol] machine

  5. #5

    Thread Starter
    Addicted Member
    Join Date
    Jul 2004
    Posts
    235
    eh...its says unsupported type of member

  6. #6
    Fanatic Member brown monkey's Avatar
    Join Date
    Jun 2004
    Location
    Cebu
    Posts
    552
    is your cf2 a form or what? if not, declare it as a form cause no other controls have .showdialog() method [ i think, i'm not sure though ]

  7. #7

    Thread Starter
    Addicted Member
    Join Date
    Jul 2004
    Posts
    235
    yeah, cf2 is a form...

    Dim cf2 as new Form2

    cf2.ShowDialog() ---> this is the error

  8. #8
    Addicted Member toytoy's Avatar
    Join Date
    Jul 2004
    Posts
    230
    I think you can try Overridable in the base class and Overrides in the sub class.........

    Or Use .Show()... .
    Visible method.....
    or .Enable in the If Else loop.....

    If not i not so sure......must ask expert lor

  9. #9
    Hyperactive Member
    Join Date
    Mar 2004
    Location
    Prato - Tuscany - Italy
    Posts
    461
    When something is too complicate, or I don't know how to use it, normally I try to follow a different path, waiting to be more expert to use it. You can choose this way, making your form1 Hidden before to show Form2, and making Form1 visible, when Form2 is closing. Obviously you must be able to refer Form1 from Form2, if this is a problem, you have to remember to declare Form1 as public in a module. Anyway in this particular case, the situation is not 'We don't know how to Show a form modally', but 'We can't figure why it doesn't work!' , so perhaps there is a little problem to understand and to solve, before it will jump on you later!
    Live long and prosper (Mr. Spock)

  10. #10
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170
    Where are you calling this code from?

    Also, I'd suggest you do all this from a module. Declare form1 and 2 from the module, call 1, and you can then try calling 2 from 1.

  11. #11

    Thread Starter
    Addicted Member
    Join Date
    Jul 2004
    Posts
    235
    what do you mean by doing a module?
    do you have a simple example ?

  12. #12
    Hyperactive Member
    Join Date
    Mar 2004
    Location
    Prato - Tuscany - Italy
    Posts
    461
    But.....the strange thing, I think, is that our friend 'hhh' is able to 'show' form2, but not 'showdialog'. Reference problem, as I wrote, should be when (and IF) he tryes to refer Form1 from Form2, or not?
    Anyway to declare (only declare, without instance) forms as public in a module, is generally a very good idea. Last but not least, I could have misunderstood the problem. It happens sometime also on italian forum, but when I use english the probabilities of fail greatly increase!
    I hope hhh will post the solution when he will find it. I'm very curious, but not so experienced to give him a real help!
    Good luck
    Live long and prosper (Mr. Spock)

  13. #13

    Thread Starter
    Addicted Member
    Join Date
    Jul 2004
    Posts
    235
    Currently I am in form1...I would like to show form2 from form1 with the help of a button.

    So how do i go about doing a simple module for it ?

  14. #14
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170
    I know, but I don't know the direct solution either.

    In a module:

    VB Code:
    1. Dim f1 as New Form1
    2. Dim f2 as New Form2
    3. f1.Show()
    4. 'or Application.Start f1

    Then, from form1, try

    f2.Show()

    Good luck.

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