Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Reading a text doc?
#11
(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.
Reply
#12
(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
Reply
#13
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.
Reply
#14
(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?
Reply
#15
Same place as your program, or it wont work unless you specify the location.
"Death smiles at us all. All a man can do is smile back".
[Image: siggy.png]
MSN: Xzotic@live.com
Reply
#16
I see
could i make the .txt a .dat?
Reply
#17
(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.
Reply
#18
kk Thanks Smile Going to attempt to add this in when i get home@!
Reply
#19
I think it would be more stable if you wrote the whole thing out.
Reply
#20
(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
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  TextBox2.Text | Transfer Text to ListBox Die 3 2,664 01-02-2012, 06:09 PM
Last Post: AceInfinity
  Text Converter. Turn your text upside down! Red X 29 8,689 08-01-2011, 07:46 AM
Last Post: Red X

Forum Jump:


Users browsing this thread: 5 Guest(s)