using buttons to open a new form?

Discussion in 'Programming General' started by mike_ftl, Feb 21, 2009.

Thread Status:
Not open for further replies.
using buttons to open a new form?
  1. Unread #1 - Feb 21, 2009 at 3:27 PM
  2. mike_ftl
    Joined:
    Oct 19, 2008
    Posts:
    85
    Referrals:
    1
    Sythe Gold:
    5

    mike_ftl Member

    using buttons to open a new form?

    i made a form that has 3 buttons.
    I need to know how to use buttons to open a new form and open another application.
    Also how can i make the program minimize to tray?
    if you have the answer or know a good resource to a vb noob
    Thanks

    ( i am making a shutdown timer for myself as the ones i have on my computer are absolute shit and dont work.)
     
  3. Unread #2 - Feb 21, 2009 at 3:31 PM
  4. World Domination
    Joined:
    Apr 9, 2007
    Posts:
    1,563
    Referrals:
    3
    Sythe Gold:
    5

    World Domination Guru
    Banned

    using buttons to open a new form?

    To make a button open a form do the following:

    Code:
    Private Sub [COLOR="DarkGreen"]Command1[/COLOR]_Click()
    [COLOR="Red"]Form2[/COLOR].Show
    End Sub
    Change the green text to the name of your button.
    Change the red text to the name of the form you wish to open.

    If you got any questions feel free to ask.
     
  5. Unread #3 - Feb 21, 2009 at 3:36 PM
  6. mike_ftl
    Joined:
    Oct 19, 2008
    Posts:
    85
    Referrals:
    1
    Sythe Gold:
    5

    mike_ftl Member

    using buttons to open a new form?

    wow thank you so much.
    You dont know how much you just helped me.
    what about opening an exe file?
     
  7. Unread #4 - Feb 21, 2009 at 3:38 PM
  8. mike_ftl
    Joined:
    Oct 19, 2008
    Posts:
    85
    Referrals:
    1
    Sythe Gold:
    5

    mike_ftl Member

    using buttons to open a new form?

    one thing it says form 5 is not declared.
    whats that mean
     
  9. Unread #5 - Feb 21, 2009 at 3:42 PM
  10. World Domination
    Joined:
    Apr 9, 2007
    Posts:
    1,563
    Referrals:
    3
    Sythe Gold:
    5

    World Domination Guru
    Banned

    using buttons to open a new form?

    Almost the same way, except:

    Code:
    Private Sub [COLOR="DarkGreen"]Command1[/COLOR]_Click()
    
    Dim RetVal
    RetVal = Shell("[COLOR="Red"]file location[/COLOR]") 
    
    
    End Sub
    Once again,
    Change the green text to the name of your button.
    Change the red text to the location of the file you wish to open.

    For example:

    Code:
    Private Sub Command1_Click()
    
    Dim RetVal
    RetVal = Shell("C:\WINDOWS\System32\calc.exe") 
    
    End Sub
    That above code will open the Calculator.
     
  11. Unread #6 - Feb 21, 2009 at 9:26 PM
  12. SuF
    Joined:
    Jan 21, 2007
    Posts:
    14,212
    Referrals:
    28
    Sythe Gold:
    1,234
    Discord Unique ID:
    203283096668340224
    <3 n4n0 Two Factor Authentication User Community Participant Spam Forum Participant Sythe's 10th Anniversary

    SuF Legend
    Pirate Retired Global Moderator

    using buttons to open a new form?

    Please post in the forum specific for the language you are working with next time... What language is this anyways? VB .Net?
     
  13. Unread #7 - Feb 21, 2009 at 10:15 PM
  14. Darthatron
    Joined:
    May 22, 2006
    Posts:
    1,612
    Referrals:
    3
    Sythe Gold:
    0

    Darthatron Massive Troll
    Retired Sectional Moderator Visual Basic Programmers

    using buttons to open a new form?

    You should move it Mr. Mod. It's VB6, by the way.
     
  15. Unread #8 - Feb 21, 2009 at 10:24 PM
  16. SuF
    Joined:
    Jan 21, 2007
    Posts:
    14,212
    Referrals:
    28
    Sythe Gold:
    1,234
    Discord Unique ID:
    203283096668340224
    <3 n4n0 Two Factor Authentication User Community Participant Spam Forum Participant Sythe's 10th Anniversary

    SuF Legend
    Pirate Retired Global Moderator

    using buttons to open a new form?

    I was going to, but I did not know to where... :p
     
  17. Unread #9 - Mar 2, 2009 at 5:34 PM
  18. hampe-92
    Joined:
    Jul 10, 2008
    Posts:
    328
    Referrals:
    0
    Sythe Gold:
    0

    hampe-92 Forum Addict

    using buttons to open a new form?

    haha, and you're supposed to be programmer mod xD
    hehe, anyways.. I believe you should move this thread and this (his other shutdown timer help thread) http://sythe.org/showthread.php?t=574315
    to visual basic .net forum, since he said he uses visual studio 2008 (= vb.net)... and that's probably why the code given doesn't work for him :)
     
  19. Unread #10 - Apr 5, 2009 at 9:06 AM
  20. abluescarab
    Joined:
    Oct 10, 2008
    Posts:
    18
    Referrals:
    0
    Sythe Gold:
    0

    abluescarab Newcomer

    using buttons to open a new form?

    1) To open a new form, add the form to your project and then add this code in the Click procedure for the button:
    Code:
    frmName.show [vbModal]
    The vbModal is optional; if no vbModal is present in the code, you can switch between forms without closing the second form; if vbModal is present, you must close the second form before you can view the first.

    2) To open a program, you must use the Shell command. I'm not very experienced at it, so you will have to use the MSDN library or Google it.

    3) Unfortunately, I don't know the answer to this, and I'm not sure it's possible, so sorry I can't help with that.

    I hope the one answer I gave you will be helpful :p lol Good luck!
     
  21. Unread #11 - Apr 5, 2009 at 10:20 PM
  22. Darthatron
    Joined:
    May 22, 2006
    Posts:
    1,612
    Referrals:
    3
    Sythe Gold:
    0

    Darthatron Massive Troll
    Retired Sectional Moderator Visual Basic Programmers

    using buttons to open a new form?

    Stop grave digging already. >_>
     
< Paying you to program $$$ | Need Auto Clicker >

Users viewing this thread
1 guest
Thread Status:
Not open for further replies.


 
 
Adblock breaks this site