|
-
Oct 29th, 2009, 05:06 PM
#1
Thread Starter
Addicted Member
Info needed on loading program config/text box contents
Hi all,
I need some advice/info on how to tackle this problem.
Currently I have a config file which contains info needed for my program. When the program first runs it reads this info and puts it into variables. So far no problem.
As the program has grown, there is more and more info in this file and I have decided to add a tab to my program so that the user can change he info here rather than having to alter a config file in notepad, whcih some users may not really know how to do, OR run the risk of making a small mistake which would cause the program not to run.
So, the question is, should I (which is my only idea so far) continue to load the settings from this config file but instead load them into textboxes on the new config tab and write back to the file on program exit (should they have been modified)?
OR, is there and easer way to tackle this?
Thanks for your input and advice.
-
Oct 29th, 2009, 05:09 PM
#2
Re: Info needed on loading program config/text box contents
whcih some users may not really know how to do,
What is the guarantee that they will know what to change the text in the textbox?
I believe if the user if familiar with the settings then changing it in the notepad shouldn't be a great big deal... Well, it is just my opinion...
A good exercise for the Heart is to bend down and help another up...
Please Mark your Thread " Resolved", if the query is solved
MyGear:
★ CPU ★ Ryzen 5 5800X
★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
★ Keyboard ★ TVS Electronics Gold Keyboard
★ Mouse ★ Logitech G502 Hero
-
Oct 29th, 2009, 05:41 PM
#3
Re: Info needed on loading program config/text box contents
Are there a finite number of things/values that the users could enter in the textboxes? If so then comboboxes might be a better idea. Barring that can you validate what the users enter?
-
Oct 29th, 2009, 06:03 PM
#4
Thread Starter
Addicted Member
Re: Info needed on loading program config/text box contents
 Originally Posted by koolsid
What is the guarantee that they will know what to change the text in the textbox?
I believe if the user if familiar with the settings then changing it in the notepad shouldn't be a great big deal... Well, it is just my opinion...
Good point, I was just thinking really that it is easier to edit/change in textboxes and there is less chance of them making a mess of the config file where everything has to be on specific lines, in a certain format and order, whereas textboxes is a bit easier.
-
Oct 29th, 2009, 06:05 PM
#5
Thread Starter
Addicted Member
Re: Info needed on loading program config/text box contents
 Originally Posted by MartinLiss
Are there a finite number of things/values that the users could enter in the textboxes? If so then comboboxes might be a better idea. Barring that can you validate what the users enter?
Good idea, but not really, no... They would be entering all sorts of different data, mail servers, email addresses, numbers, etc... lots of different things, would be too ahrd to validate, and combo boxes not an option unfortunately.
-
Oct 29th, 2009, 06:12 PM
#6
Re: Info needed on loading program config/text box contents
As the program has grown, there is more and more info in this file
Also, If this continues... How many modifications are you going to make in your program to sync with the data in the file?
A good exercise for the Heart is to bend down and help another up...
Please Mark your Thread " Resolved", if the query is solved
MyGear:
★ CPU ★ Ryzen 5 5800X
★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
★ Keyboard ★ TVS Electronics Gold Keyboard
★ Mouse ★ Logitech G502 Hero
-
Oct 29th, 2009, 06:43 PM
#7
Re: Info needed on loading program config/text box contents
Then I think the "best" idea is to go with the textbox approach and validate what you can. I don't know anything about mail server names, but I believe you can do some validation on email addresses, and for numbers you can use my NumberBox ActiveX control which restricts input to numbers and allows you to set other parameters which restrict the numeric values.
-
Nov 3rd, 2009, 01:00 PM
#8
Thread Starter
Addicted Member
Re: Info needed on loading program config/text box contents
Hi all, thank you for all your replies, sorry for leaving it for a while and now bumping...
I have decided that the route I will take is to load the values from the config file, assign them to the textboxes, and on program end, write them back to the config file from the textboxes...
Any reason that will not work or am I looking at it from the wrong point of view?
Thanks.
-
Nov 3rd, 2009, 01:04 PM
#9
Re: Info needed on loading program config/text box contents
I think what everyone was eluding to was this: What really matters is what is changed in the textboxes and whether your app can operate with those changes. Therefore it is best to validate any changes as soon as possible after they are modified by the user.
As a side note. Only save the data if something changed. Waste of time saving unchanged data, no? You can use a simple form-level boolean flag to determine whether any changes were made or not and if that boolean is True, save, else don't.
-
Nov 3rd, 2009, 01:09 PM
#10
Re: Info needed on loading program config/text box contents
I think that adding a flag to tell if an item has changed is unnecessary; it's much simpler to save all the data every time on exit.
BTW, you don't need to maintain your own config file; you can just use the Registry. If you don't know how to do that then see my How to use SaveSetting and GetSetting example.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|