Our new Indie Games subforum is now open for business in G&T. Go and check it out, you might land a code for a free game. If you're developing an indie game and want to post about it, follow these directions. If you don't, he'll break your legs! Hahaha! Seriously though.
Our rules have been updated and given their own forum. Go and look at them! They are nice, and there may be new ones that you didn't know about! Hooray for rules! Hooray for The System! Hooray for Conforming!

VB.net Question

jhunter46jhunter46 Registered User regular
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 Registered User regular
    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

  • jhunter46jhunter46 Registered User regular
    Text file it will be. Thanks :-P

  • Vladimir7Vladimir7 Registered User
    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.

  • ProtoProto Registered User regular
    jhunter46 wrote: »
    Text file it will be. Thanks :-P

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

    and her knees up on the glove compartment
    took out her barrettes and her hair spilled out like rootbeer
  • HeirHeir Registered User regular
    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.

    camo_sig2.png
  • bowenbowen Registered User regular
    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.

  • GanluanGanluan Registered User regular
    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.

  • bowenbowen Registered User regular
    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.

This discussion has been closed.