Results 1 to 15 of 15

Thread: First Run

  1. #1

    Thread Starter
    Lively Member
    Join Date
    May 2008
    Posts
    90

    First Run

    Hi, hope you can help, i want to be able allow my program to be able to dfetect if it has been run before (so that if it hasnt it will load the setup form where i can fill in my details) and then if i run the program again it will run the regular form

    PSUEDO

    Run the proram --> Detects if it has been run before --> No, then load the setup form...

    Run the proram --> Detects if it has been run before --> Yes, then load the logon form.

    Thanks in advance
    Stuart Jones
    Network Manager

  2. #2
    King of sapila
    Join Date
    Oct 2006
    Location
    Greece
    Posts
    6,763

    Re: First Run

    You can do it in many ways.
    With a value check on the registry.
    With a file that has an i/o that will tell you if the program has been run.
    Inside the program with application settings.
    Getting a value from a database.

    Registry or application settings seems better to me but you can do it in any way you like.

  3. #3
    Fanatic Member
    Join Date
    Feb 2007
    Location
    Eindhoven
    Posts
    828

    Re: First Run

    have a look at
    vb Code:
    1. my.settings
    you can also viiew it by dblclicking on project under the solution explorer window

  4. #4

    Thread Starter
    Lively Member
    Join Date
    May 2008
    Posts
    90

    Re: First Run

    Thanks for the replies.

    I would like to do this through the registry if you know how this is done

    Thanks in advance
    Stuart Jones
    Network Manager

  5. #5

  6. #6
    Raging swede Atheist's Avatar
    Join Date
    Aug 2005
    Location
    Sweden
    Posts
    8,018

    Re: First Run

    Using the application settings would be far better than using the registry.
    Rate posts that helped you. I do not reply to PM's with coding questions.
    How to Get Your Questions Answered
    Current project: tunaOS
    Me on.. BitBucket, Google Code, Github (pretty empty)

  7. #7

    Thread Starter
    Lively Member
    Join Date
    May 2008
    Posts
    90

    Re: First Run

    Hi, Thanks for the reply

    Can you please explain why that would be better from my point of view i see that a registry key will stivk until it is deleted, but i have never used the my.settings.

    Please advise
    Stuart Jones
    Network Manager

  8. #8
    Raging swede Atheist's Avatar
    Join Date
    Aug 2005
    Location
    Sweden
    Posts
    8,018

    Re: First Run

    Well, the fact that the registry entry will stay until its deleted is not really an argument, as the same goes for pretty much anything.
    The reason one shouldnt use the registry is that it:
    - Clutters the registry.
    - Requires the user to have the privileges to edit the registry. Vista, for example, will not like your application

    The application settings is defenitely the way to go. Alot simpler too.
    Rate posts that helped you. I do not reply to PM's with coding questions.
    How to Get Your Questions Answered
    Current project: tunaOS
    Me on.. BitBucket, Google Code, Github (pretty empty)

  9. #9

    Thread Starter
    Lively Member
    Join Date
    May 2008
    Posts
    90

    Re: First Run

    Hi, well i rest my case do you know how to configure that i only thought the registry was a gd idea because i knew what i was doing and i am so unfamiliar with the my.setting.

    Your help is appreciated
    Stuart Jones
    Network Manager

  10. #10
    Fanatic Member
    Join Date
    Feb 2007
    Location
    Eindhoven
    Posts
    828

    Re: First Run

    The seetings reprensent a collection of information (an array). You can access different items as you would for any other collection.

    vb Code:
    1. if convert.toBoolean(my.Settings.item("HasBeenUsedBefore")) then
    2.   'your code
    3. end if

  11. #11
    Raging swede Atheist's Avatar
    Join Date
    Aug 2005
    Location
    Sweden
    Posts
    8,018

    Re: First Run

    As of a coinsidence, this question was asked just the other day. Check this thread, i've described how to add and use an application setting in there.
    Rate posts that helped you. I do not reply to PM's with coding questions.
    How to Get Your Questions Answered
    Current project: tunaOS
    Me on.. BitBucket, Google Code, Github (pretty empty)

  12. #12
    Fanatic Member
    Join Date
    Feb 2007
    Location
    Eindhoven
    Posts
    828

    Re: First Run

    Atheist, may I ask what version of VS are u using. I can't find it My.Settings.firstExecution in VS2005.

  13. #13
    Raging swede Atheist's Avatar
    Join Date
    Aug 2005
    Location
    Sweden
    Posts
    8,018

    Re: First Run

    Quote Originally Posted by talkro
    Atheist, may I ask what version of VS are u using. I can't find it My.Settings.firstExecution in VS2005.
    Im using both VS 2005 and 2008.
    My.Settings exists on all versions of .NET that are of version 2.0 or above, and whenever you add a setting through the settings tab in the project properties, you can access it through the My.Settings property.

    So in your case, you just havent added a setting called "firstExecution"
    Rate posts that helped you. I do not reply to PM's with coding questions.
    How to Get Your Questions Answered
    Current project: tunaOS
    Me on.. BitBucket, Google Code, Github (pretty empty)

  14. #14
    Fanatic Member
    Join Date
    Feb 2007
    Location
    Eindhoven
    Posts
    828

    Re: First Run

    ok, i get it.
    use to access the values inside my setting with

    vb Code:
    1. My.Settings.Item("HasBeenRun") = True
    instead of
    vb Code:
    1. my.Setting.hasBeenRun

    lack of curiosity there from me.

  15. #15

    Thread Starter
    Lively Member
    Join Date
    May 2008
    Posts
    90

    Re: First Run

    Thanks for the update its appreciated i will post back and let you know the results soon

    Many Thanks,
    Stuart Jones
    Network Manager

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