Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Mar 26th, 2008, 10:40 AM   #1
Jabo
Not a user?
 
Join Date: Sep 2007
Posts: 272
Rep Power: 2 Jabo is on a distinguished road
First-time setup of application

I want to have my program check to see if certain information has been setup up, like server address, etc. I want the application to check and if this information hasn't been setup, then it will prompt the user to enter this information for first-time setup. I tried putting this in the first form load event, but it doesn't do what I want. Can somebody point me in the right direction?
Jabo is offline   Reply With Quote
Old Mar 27th, 2008, 8:05 AM   #2
Infinite Recursion
Programming Guru
 
Infinite Recursion's Avatar
 
Join Date: Jul 2004
Location: United States
Posts: 3,467
Rep Power: 8 Infinite Recursion is on a distinguished road
Send a message via MSN to Infinite Recursion Send a message via Yahoo to Infinite Recursion
Re: First-time setup of application

How about in the Form_Load, you check for values in the registry that indicate if the information has previously been provided?
__________________
http://jasonpowers.net

"There are a thousand hacking at the branches of evil to one who is striking at the root."
Infinite Recursion is offline   Reply With Quote
Old Mar 27th, 2008, 7:46 PM   #3
Jabo
Not a user?
 
Join Date: Sep 2007
Posts: 272
Rep Power: 2 Jabo is on a distinguished road
Re: First-time setup of application

I'm not that sophisticated yet Recursion; my information is held in .txt files. I tried putting my check in the main form load event, but it ignores it. I'd like to do my checks before the main form loads, but don't know how.
Jabo is offline   Reply With Quote
Old Mar 27th, 2008, 8:51 PM   #4
Ooble
I eat cake for breakfast.
 
Ooble's Avatar
 
Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 9 Ooble is on a distinguished road
Re: First-time setup of application

Show us some code, Jabo.
__________________
Me :: You :: Them
Ooble is offline   Reply With Quote
Old Mar 27th, 2008, 10:56 PM   #5
Jabo
Not a user?
 
Join Date: Sep 2007
Posts: 272
Rep Power: 2 Jabo is on a distinguished road
Re: First-time setup of application

The code that I tried is the first IF statement. I realize that the form hasn't loaded yet and can't be hid, but why wouldn't it show my other form? How can I do this better?

Also, frommail is a string that has been assigned a filepath. It was declared publicly.

vb Syntax (Toggle Plain Text)
  1. Private Sub Pinger_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
  2.  
  3. Dim tabs() As Integer = {20, 40, 60, 80}
  4.  
  5. If IO.File.Exists(frommail) = False Then
  6. Me.Hide()
  7. frmFromEmail.Show()
  8. End If
  9.  
  10. 'Set result textbox to nothing on load
  11. rtbResult.Text = ""
  12. 'Ensure timer is enabled
  13. tmrTimer.Enabled = True
  14. 'Set toolstrip Status message
  15. tssStatus.Text = "Pinging Started"
  16. 'Set toolstrip Activity to None
  17. tssActivity.Text = "Current Task: None"
  18. 'Cause both toolstrips to redraw
  19. tssStatus.Invalidate()
  20. tssActivity.Invalidate()
  21. 'set Result textbox tabs
  22. rtbResult.SelectionTabs = tabs
  23. 'Enable Stop toolstrip and disable Start toolstrip
  24. StopToolStripMenuItem.Enabled = True
  25. StartToolStripMenuItem.Enabled = False
  26. 'Set timer interval to 15 minutes
  27. interval = 900000
  28. tmrTimer.Interval = interval
  29. 'Make email active menu checked
  30. EmailActiveToolStripMenuItem.Checked = True
  31. 'Set 15 minute menu to checked, all others unchecked
  32. MinutesToolStripMenuItem.Checked = False
  33. MinutesToolStripMenuItem1.Checked = False
  34. MinutesToolStripMenuItem2.Checked = True
  35. MinutesToolStripMenuItem3.Checked = False
  36. MinutesToolStripMenuItem4.Checked = False
  37. 'Set printing to inactive
  38. PrintingActiveToolStripMenuItem.Checked = False
  39. 'Set interval label to 15 minutes
  40. lblInterval.Text = "Ping interval: " & tmrTimer.Interval.ToString / 60000 & " minutes"
  41. 'Start timer and cause first ping to run
  42. tmrTimer.Start()
  43. Ping_list()
  44.  
  45.  
  46. End Sub
Jabo is offline   Reply With Quote
Old Mar 28th, 2008, 12:10 AM   #6
Jabo
Not a user?
 
Join Date: Sep 2007
Posts: 272
Rep Power: 2 Jabo is on a distinguished road
Re: First-time setup of application

Basically, this program needs an email server to send to, a From: email address and some other text files with specific information that the program needs to work properly. I don't want the program to crash on somebody on first use, which it has been doing until those files are created. After the files are there, program works fine. I guess what I'm looking for is the VB equivalent of preprocessor directives such as #ifdef and #ifndef.

I had all that information hard-coded into the program for work use, but they changed our domain on our emails, which meant I had to go back and change the information then recompile. I want my program more robust than that so I'm removing the key elements being hard-coded into the program.
Jabo is offline   Reply With Quote
Old Mar 28th, 2008, 11:59 AM   #7
Ooble
I eat cake for breakfast.
 
Ooble's Avatar
 
Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 9 Ooble is on a distinguished road
Re: First-time setup of application

Seems the problem is with this line:
vb Syntax (Toggle Plain Text)
  1. frmFromEmail.Show()
Try this. Can't guarantee anything as I'm not a VB coder, but hopefully it'll work.
vb Syntax (Toggle Plain Text)
  1. Private Sub Pinger_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
  2. Dim tabs() As Integer = {20, 40, 60, 80}
  3. Dim FromEmailForm As New frmFromEmail()
  4.  
  5. If IO.File.Exists(frommail) = False Then
  6. Me.Hide()
  7. FromEmailForm.Show()
  8. End If
__________________
Me :: You :: Them
Ooble is offline   Reply With Quote
Old Mar 28th, 2008, 7:57 PM   #8
Jabo
Not a user?
 
Join Date: Sep 2007
Posts: 272
Rep Power: 2 Jabo is on a distinguished road
Re: First-time setup of application

I'll give it a try, thanks for the suggest Ooble
Jabo is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
help in setup file nascar2000 Visual Basic .NET 3 Feb 11th, 2007 7:03 PM
way to make a function execute at time 'x' badbasser98 C++ 10 Apr 5th, 2006 7:14 AM
checking file existing time to time, in the same time program do other operation myName C++ 3 Mar 13th, 2006 8:39 PM
Why do the smallest apps take the most time to execute...? Senger Coder's Corner Lounge 10 Nov 5th, 2005 1:42 PM
Time ChronicCode Java 2 Aug 11th, 2005 2:22 PM




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 2:10 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC