Support Forums

Full Version: Reading a text doc?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3
(11-13-2010, 02:44 PM)Xzotic Wrote: [ -> ]I really think that it would be easier in the end to just code it in the program itself. Put it in a function so all you have to do is call a function. Of course that would take more planning that just what i said. Might need to add a few more variables and statements, but overall I think it is a better method. You would still have to read it from the file everytime + have the information in the file.

I agree, unless you plan on changing the level values after the program has been built, or through settings of some sort. I think the best way would be to hard code it, and think of a way to incorporate how much the exp goes up into what level they are on into a function. If you really want code on how to read from a text I will give it to you, but reading the text is just the beginning. You will have to specify the data to only pull what you need per level.
(11-13-2010, 03:05 PM)the_GENie Wrote: [ -> ]I agree, unless you plan on changing the level values after the program has been built, or through settings of some sort. I think the best way would be to hard code it, and think of a way to incorporate how much the exp goes up into what level they are on into a function. If you really want code on how to read from a text I will give it to you, but reading the text is just the beginning. You will have to specify the data to only pull what you need per level.
Actually i wanted 3 text files one named exp-easy one named exp-hard etc and each one would be harder/easier
Code:
Dim reader As System.IO.StreamReader
Dim filename As String = "exp-easy.txt"
reader = System.IO.File.OpenText(filename)
textbox1.Text = reader.ReadToEnd
reader.Close()

Here, this will get you started. This will open a textfile named exp-easy.txt and load it into a textbox. Adapt it to suit your needs.
(11-13-2010, 03:22 PM)the_GENie Wrote: [ -> ]
Code:
Dim reader As System.IO.StreamReader
Dim filename As String = "exp-easy.txt"
reader = System.IO.File.OpenText(filename)
textbox1.Text = reader.ReadToEnd
reader.Close()

Here, this will get you started. This will open a textfile named exp-easy.txt and load it into a textbox. Adapt it to suit your needs.

Thanks but where is the exp-easy.txt saved?
Same place as your program, or it wont work unless you specify the location.
I see
could i make the .txt a .dat?
(11-13-2010, 03:40 PM)pers2981 Wrote: [ -> ]I see
could i make the .txt a .dat?

Yes, as long as it's saved as exp-easy.dat and you have it loaded in using the code above it will act the same way as a txt file.
kk Thanks Smile Going to attempt to add this in when i get home@!
I think it would be more stable if you wrote the whole thing out.
(11-14-2010, 04:36 AM)JMK940 Wrote: [ -> ]I think it would be more stable if you wrote the whole thing out.
all 999 levels :L
Pages: 1 2 3