Link to home
Start Free TrialLog in
Avatar of slightlyoff
slightlyoff

asked on

Read Value Pairs from a Text File VB.NET

I'm looking for the best way to read values from a text file into a vb.net winforms application.

I'm hoping to take regular messages like "Couldn't connect to the database" or "We were not able to complete the task" and put it in a text file like this:

1, "Couldn't connect to the database"
2, "We were not able to complete the task"

So that someone without a lot of experience programming could change the messages if they wanted. (for example, they could change the to a different language.

It would be great as well if this could be done with comments like this:

\\Error Messages
1, "Couldn't connect to the database."
2, "We were not able to complete the task."

\\System Update
3, "We updated the information successfully."
4, "Please enter your username"

My goal is to be able to refer to the number to get to the message.  I thought perhaps I could do it using Dictionary, it seems like the values have to be hard coded...  I could read List (Of T), but that would mean that the items have to be in order and I'd have to loop through the entire list to get what I want... doesn't seem too efficient.

I'd rather not use a database for this - but if I have to, I guess I will.
Any suggestions on the best course of action would be helpful!

Thanks for your time!!!
ASKER CERTIFIED SOLUTION
Avatar of Miguel Oz
Miguel Oz
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of slightlyoff
slightlyoff

ASKER

Thank you very much!  That seems much better than what I was thinking :)

Thank you for your time!