Results 1 to 21 of 21

Thread: Loop form start(check out # trick)(RESOLVED)

Hybrid View

  1. #1
    Software Carpenter dee-u's Avatar
    Join Date
    Feb 2005
    Location
    Pinas
    Posts
    11,127

    Re: Loop form start

    May I ask how does your program starts? Is it through Sub Main?

    VB Code:
    1. Private Sub Command1_Click
    2. Unload Me
    3. 'call the procedure taht displays your message boxes or unload then load the form that display your message boxes....
    4. End Sub
    Regards,


    As a gesture of gratitude please consider rating helpful posts. c",)

    Some stuffs: Mouse Hotkey | Compress file using SQL Server! | WPF - Rounded Combobox | WPF - Notify Icon and Balloon | NetVerser - a WPF chatting system

  2. #2
    Elite Hacker Jacob Roman's Avatar
    Join Date
    Aug 2004
    Location
    Miami Beach, FL
    Posts
    5,349

    Re: Loop form start

    I could have suggested Sub Main() if there were to be just message boxes with the Form not being needed

    To do this all you would need is just a module, and no Form. In that module, if you have a sub routine like this:

    VB Code:
    1. Option Explicit
    2.  
    3. Private Sub Main()
    4.  
    5.      'Example:
    6.  
    7.      Msgbox "Kool man!!!", vbExclamation
    8.  
    9. End Sub

    Visual Basic automatically calls this sub when no form is present. Same holds true in C and C++

    Code:
    #include <stdio.h>
    
    int main(void)
    {
    
        printf("Kool man!!!\n",);
    
        return 0; 
    
    }

  3. #3

    Thread Starter
    Lively Member nickTHEguitarist's Avatar
    Join Date
    Apr 2005
    Location
    Michigan
    Posts
    82

    Re: Loop form start

    When I created the sub routine, and i put in the form_activate, I need MessageBox_Trick() to be equal to something?
    Nick

  4. #4
    Elite Hacker Jacob Roman's Avatar
    Join Date
    Aug 2004
    Location
    Miami Beach, FL
    Posts
    5,349

    Re: Loop form start

    Then make it a function so that it can return a value. Like for example:

    VB Code:
    1. Private Function MessageBox_Trick() As Long
    2.  
    3.     MsgBox "I'm Kool", vbExclamation
    4.     MsgBox "I'm Awesome", vbExclamation
    5.     MsgBox "I'm just freakin slick man", vbExclamation
    6.  
    7.     [b]MessageBox_Trick = 10[/b]
    8.    
    9.     If MsgBox("Again?!!", vbQuestion Or vbYesNo) = vbYes Then Call MessageBox_Trick
    10.  
    11. End Function
    12.  
    13. Private Sub Form_Activate()
    14.  
    15.      Print MessageBox_Trick
    16.      
    17.      'The output is 10 and will be viewed if vbNo is selected
    18.  
    19. End Sub

  5. #5

    Thread Starter
    Lively Member nickTHEguitarist's Avatar
    Join Date
    Apr 2005
    Location
    Michigan
    Posts
    82

    Resolved Re: Loop form start

    K thanks Jacob, I got it to work now. (The first time I got a form to work from advice of this forum )
    Nick

  6. #6

    Thread Starter
    Lively Member nickTHEguitarist's Avatar
    Join Date
    Apr 2005
    Location
    Michigan
    Posts
    82

    Re: Loop form start(RESOLVED)

    Check out the Number trick
    Attached Files Attached Files
    Nick

  7. #7
    Elite Hacker Jacob Roman's Avatar
    Join Date
    Aug 2004
    Location
    Miami Beach, FL
    Posts
    5,349

    Re: Loop form start(check out # trick)(RESOLVED)

    You may wanna fix a little something there. Open your Number Trick.vbp file with notepad and look for this line:

    Form=..\..\..\..\DOCUME~1\Owner\Desktop\NUMBER~1.FRM

    Change that line to this:

    Form=NUMBER~1.FRM

    Otherwise people who are trying to open your project will get an error message.

    Nice beginner program. Let's step it up a notch. Try these two programs I made and uploaded in my site

    www.angelfire.com/fl5/memorydll/index.html

    The controls are these:

    Mouse: Freelook
    Arrow keys: moves sprite
    Space: Fire (except in MKvsSF)
    Numpad: Controls camera
    F12: Snapshot
    Esc: Exits program

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