Results 1 to 10 of 10

Thread: Info needed on loading program config/text box contents

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Feb 2009
    Posts
    145

    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.

  2. #2
    Discovering Life Siddharth Rout's Avatar
    Join Date
    Feb 2005
    Location
    Mumbai, India
    Posts
    12,001

    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

  3. #3
    Former Admin/Moderator MartinLiss's Avatar
    Join Date
    Sep 1999
    Location
    San Jose, CA
    Posts
    33,431

    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?

  4. #4

    Thread Starter
    Addicted Member
    Join Date
    Feb 2009
    Posts
    145

    Re: Info needed on loading program config/text box contents

    Quote Originally Posted by koolsid View Post
    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.

  5. #5

    Thread Starter
    Addicted Member
    Join Date
    Feb 2009
    Posts
    145

    Re: Info needed on loading program config/text box contents

    Quote Originally Posted by MartinLiss View Post
    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.

  6. #6
    Discovering Life Siddharth Rout's Avatar
    Join Date
    Feb 2005
    Location
    Mumbai, India
    Posts
    12,001

    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

  7. #7
    Former Admin/Moderator MartinLiss's Avatar
    Join Date
    Sep 1999
    Location
    San Jose, CA
    Posts
    33,431

    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.

  8. #8

    Thread Starter
    Addicted Member
    Join Date
    Feb 2009
    Posts
    145

    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.

  9. #9
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,541

    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.
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

  10. #10
    Former Admin/Moderator MartinLiss's Avatar
    Join Date
    Sep 1999
    Location
    San Jose, CA
    Posts
    33,431

    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
  •  



Click Here to Expand Forum to Full Width