Results 1 to 10 of 10

Thread: showing form

  1. #1

    Thread Starter
    Lively Member afterMoon's Avatar
    Join Date
    Oct 2002
    Location
    cochin
    Posts
    117

    showing form

    like in vb 6, how can I unload a form and show another in VB.Net?
    when in doubt, win the trick

  2. #2
    l33t! MrPolite's Avatar
    Join Date
    Sep 2001
    Posts
    4,428
    if you wanna unload the current form:
    me.close

    to load another one:

    dim frm as new form2
    frm.show
    rate my posts if they help ya!
    Extract thumbnail without reading the whole image file: (C# - VB)
    Apply texture to bitmaps: (C# - VB)
    Extended console library: (VB)
    Save JPEG with a certain quality (image compression): (C# - VB )
    VB.NET to C# conversion tips!!

  3. #3

    Thread Starter
    Lively Member afterMoon's Avatar
    Join Date
    Oct 2002
    Location
    cochin
    Posts
    117
    hi thanx for your patience Mr.Polite
    I tried that but getting an error while compiling
    (ie; me.close())
    variable 'Close' conflicts with sub 'Close' in the base class 'Form' and so should be declared 'Shadows'.

    please help
    when in doubt, win the trick

  4. #4
    l33t! MrPolite's Avatar
    Join Date
    Sep 2001
    Posts
    4,428
    Me.Close() works. You probably have a variable named "close" in your form and as it says, it has a conflict with that. Just rename your variable. I guess that's the problem
    I dont know about the Shadows keyword, never worked with it. I guess you could solve it without renaming it too
    rate my posts if they help ya!
    Extract thumbnail without reading the whole image file: (C# - VB)
    Apply texture to bitmaps: (C# - VB)
    Extended console library: (VB)
    Save JPEG with a certain quality (image compression): (C# - VB )
    VB.NET to C# conversion tips!!

  5. #5

    Thread Starter
    Lively Member afterMoon's Avatar
    Join Date
    Oct 2002
    Location
    cochin
    Posts
    117
    thanx mr.Polite
    you were right.
    now the problem is the next form is not showing. Instead the application exits. i have written in a button's

    me.close()
    dim frm as form2
    frm.show

    but it didn't work

    i tried this also

    dim frm as form2
    frm.show
    me.close()

    can u help me?
    when in doubt, win the trick

  6. #6
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    The first form opened maintains the thread of the application. If you close it then it closes the application also. You can use ShowDialog to show another form modally which will keep the main form from unloading until the new form is done.

  7. #7

    Thread Starter
    Lively Member afterMoon's Avatar
    Join Date
    Oct 2002
    Location
    cochin
    Posts
    117
    hi ednees
    means we can't do as it in vb6. right?
    when in doubt, win the trick

  8. #8
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    Right its a little bit different. We can't unload and load any forms anymore. Well we can just not the main form, any others will work like they did in vb6.

  9. #9
    Frenzied Member
    Join Date
    Oct 2002
    Location
    Gammapolis
    Posts
    1,474
    Try this and tell me if it helps : Add a new module to your application and create new instances of the forms in a sub main and then show the forms modally.
    Code:
    sub main()
    
    dim f1 as new form1
    dim f2 as new form2
    
    'some codes to customize form1
    f1.showdialog
    
    'some codes to customze form2
    f2.showdialog
    
    end sub
    in your form1 you should write some code to find out how the form is closed. for example if the user clicks a button to go to form2 you can have that button to act as dialog cancel button but there should be a difference between that and the exit button of the form.

  10. #10

    Thread Starter
    Lively Member afterMoon's Avatar
    Join Date
    Oct 2002
    Location
    cochin
    Posts
    117
    ya it's working. thanks Lunatic3.
    when in doubt, win the trick

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