Results 1 to 5 of 5

Thread: run project 2 times

  1. #1
    Frenzied Member
    Join Date
    Jul 04
    Posts
    1,076

    run project 2 times

    Hello,

    How would i go about getting my application to run 2 times then show form 2 then once they close form2 it dosent show form 2 anymore once the program starts again after closing.?
    come back and mark your original post as resoved if your problem is fixed

    Jamie Garland

  2. #2
    Frenzied Member
    Join Date
    Sep 06
    Posts
    1,254

    Re: run project 2 times

    If i understood well, you want to show form2 when the program run for first time and don't show it next runs, if so, use a flag saved in your settings file to check if form 2 was previously shown or not.

    Pseudo code
    vb Code:
    1. read f from setting file
    2. if f = 0 then
    3.    show form 2
    4.    f = 1
    5.    save f to setting file
    6. else
    7.    ' continue
    8. end if

  3. #3
    PowerPoster Edgemeal's Avatar
    Join Date
    Sep 06
    Location
    WindowFromPoint(x,y)
    Posts
    3,133

    Re: run project 2 times

    Sounds like you only want to show some other form the second time the app is run, you could try setting up an Integer in Project/Properties/Settings...

    Code:
    Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
        ' get value from my settings named "OpenCounter" (type = Integer, Value= 0).
        Dim i As Integer = My.Settings.OpenCounter + 1 ' increment counter
        If i < 2 Then ' dont show on first run
            My.Settings.OpenCounter = i ' save count to setting
            My.Settings.Save() ' save my settings
        ElseIf i = 2 Then ' show form2 just this once.
            My.Settings.OpenCounter = 3 ' increment to 3, never show form2 again!
            My.Settings.Save() ' save my settings
            Form2.ShowDialog() '  show form as dialog to force user to respond 
        End If
    End Sub

  4. #4
    Burning Member Niya's Avatar
    Join Date
    Nov 11
    Posts
    3,114

    Re: run project 2 times

    That could really screw up if the app crashes without a chance to decrement the counter. Just beware of that.
    Treeview with NodeAdded/NodesRemoved events | BlinkLabel control | Calculate Permutations | Object Enums | ComboBox with centered items | Create Sortable BindingList(not mine) | .Net Internals article(not mine) | Wizard Control | Understanding Multi-Threading


    C++ programmers will dismiss you as a cretinous simpleton for your inability to keep track of pointers chained 6 levels deep and Java programmers will pillory you for buying into the evils of Microsoft. Meanwhile C# programmers will get paid just a little bit more than you for writing exactly the same code and VB6 programmers will continue to whitter on about "footprints". - FunkyDexter

    There's just no reason to use garbage like InputBox. -jmcilhinney

  5. #5
    Frenzied Member
    Join Date
    Jul 04
    Posts
    1,076

    Re: run project 2 times

    Hello,

    How would you do it?.
    come back and mark your original post as resoved if your problem is fixed

    Jamie Garland

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •