The new forums will be named Coin Return (based on the most recent vote)! You can check on the status and timeline of the transition to the new forums here.
The Guiding Principles and New Rules document is now in effect.

VB.net Question

jhunter46jhunter46 Registered User regular
edited February 2009 in Help / Advice Forum
To preface, I'm a complete VB.net noob.

What I want to do is create a program that will allow someone to enter in the names of restaurants, store them and then randomly pick one when a button is clicked.

The UI is pretty simple, I have a text box and a button to save the text that is entered, and then a button to pick a random restaurant and display it in a message box.

The thing I'm trying to figure out is, how to store the names of the restaurant long term. I suppose I could do it as a text file, but is there anyway to store them internally?

jhunter46 on

Posts

  • bowenbowen Sup? Registered User regular
    edited February 2009
    No.

    You need a way of storing persistant data.

    Your choices are as follow:

    Text File
    Database
    Registry

    For what you want to do? File. The Logic is as follows:

    Open Program->Checks for file->If there is one, loads up the data->If there isn't, creates it

    Enter Restaurant->Add name to data structure and File

    Button Clicked->Randomly pick an index and find which restaurant it belongs too

    bowen on
    not a doctor, not a lawyer, examples I use may not be fully researched so don't take out of context plz, don't @ me
  • jhunter46jhunter46 Registered User regular
    edited February 2009
    Text file it will be. Thanks :-P

    jhunter46 on
  • Vladimir7Vladimir7 Registered User regular
    edited February 2009
    heh whats funny is I created this very same application except in PHP.
    There is 3 of us that goes out for lunch 2 times a week, and we would always have trouble all agreeing on a restaurant, so I created the "Restaurant Randomizer" We entered in a bunch of different restaurants, added types, and if it was a buffet or not.
    Then added a filter, so say we all felt like indian or chinese but a non buffet, we would select those two from the filter, chose non-buffet, and click the "Random" button.

    The only problem, was that it would pick a restuarant, and we would all disagree, and end up clicking the Random button multiple times, and eventually even with the randomizer we ended up going back to the same problem we started with..
    Now we each just take turns in picking and the other 2 people are not allowed to disagree, works great.

    Vladimir7 on
  • ProtoProto Registered User regular
    edited February 2009
    jhunter46 wrote: »
    Text file it will be. Thanks :-P

    XML will give you more flexibility if you want to store more then just names.

    Proto on
    and her knees up on the glove compartment
    took out her barrettes and her hair spilled out like rootbeer
  • HeirHeir Ausitn, TXRegistered User regular
    edited February 2009
    Proto wrote: »
    jhunter46 wrote: »
    Text file it will be. Thanks :-P

    XML will give you more flexibility if you want to store more then just names.


    This. XML is the way to go for something small like this.

    Heir on
    camo_sig2.png
  • bowenbowen Sup? Registered User regular
    edited February 2009
    Proto wrote: »
    jhunter46 wrote: »
    Text file it will be. Thanks :-P

    XML will give you more flexibility if you want to store more then just names.

    Naw, XML doesn't give anymore flexibility than a delimited text file. What it does give is portability of data. Depending on his environment and skill level (close to 0 admittedly), I'd say a very bad idea.

    Last I checked, dealing with XML files was still a giant pain in the sphincter. LINQ probably changed this but I haven't kept up on that aspect of .NET unfortunately.

    bowen on
    not a doctor, not a lawyer, examples I use may not be fully researched so don't take out of context plz, don't @ me
  • GanluanGanluan Registered User regular
    edited February 2009
    XLINQ makes it very easy, but even so it's probably overkill for a project like he's doing. It definitely helps to learn how to manipulate XML documents when you get more comfortable though. He didn't mention what framework version he's using, and if he's stuck on 1.1 or something then XML can be a pain in the ass.

    Ganluan on
  • bowenbowen Sup? Registered User regular
    edited February 2009
    Ganluan wrote: »
    XLINQ makes it very easy, but even so it's probably overkill for a project like he's doing. It definitely helps to learn how to manipulate XML documents when you get more comfortable though. He didn't mention what framework version he's using, and if he's stuck on 1.1 or something then XML can be a pain in the ass.

    Or that maybe it'd be a good thing to learn parsing and tokenization just like learning how to add and subtract before you get a calculator.

    Just my opinion though.

    bowen on
    not a doctor, not a lawyer, examples I use may not be fully researched so don't take out of context plz, don't @ me
This discussion has been closed.