As was foretold, we've added advertisements to the forums! If you have questions, or if you encounter any bugs, please visit this thread: https://forums.penny-arcade.com/discussion/240191/forum-advertisement-faq-and-reports-thread/
Options

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

  • Options
    bowenbowen How you doin'? 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
  • Options
    jhunter46jhunter46 Registered User regular
    edited February 2009
    Text file it will be. Thanks :-P

    jhunter46 on
  • Options
    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
  • Options
    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
  • Options
    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
  • Options
    bowenbowen How you doin'? 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
  • Options
    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
  • Options
    bowenbowen How you doin'? 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.