Posts: 50
Threads: 7
Joined: Dec 2010
Reputation:
0
Hi Brandonio and other helpers,
I want to make a program were i make a map.ini file (this is just txt for a program calld C&C generals).
The one that is using the program can typ in an textbox for oil bonus: 50
and then a txt file appears or it will get saved in it as a code like this:
InitialCaptureBonus = 8000
i have no idea to do this with multiple textboxes or even one, please help me out.
greets from holland ^^
---------------------------------------
Earn money for all your games!
<!-- m --><a class="postlink" href="http://www.cashle.com/us/1936/Earn-money-for-all-y">http://www.cashle.com/us/1936/Earn-money-for-all-y</a><!-- m -->
our-games?ref=ekel
---------------------------------------
Posts: 1,006
Threads: 111
Joined: Jul 2010
Reputation:
1
First of all, Welcome to the forums!
Have you seen this tutorial on how to save a text file? <!-- m --><a class="postlink" href="http://www.youtube.com/watch?v=xf67hCwPLIs">http://www.youtube.com/watch?v=xf67hCwPLIs</a><!-- m -->
Posts: 50
Threads: 7
Joined: Dec 2010
Reputation:
0
yes, i have seen all your tutorials.
Btw: you said it was save, but it was more a save as <!-- s --><img src="{SMILIES_PATH}/icon_razz.gif" alt=" " title="Razz" /><!-- s --> and i subd.
---------------------------------------
Earn money for all your games!
<!-- m --><a class="postlink" href="http://www.cashle.com/us/1936/Earn-money-for-all-y">http://www.cashle.com/us/1936/Earn-money-for-all-y</a><!-- m -->
our-games?ref=ekel
---------------------------------------
Posts: 1,006
Threads: 111
Joined: Jul 2010
Reputation:
1
Haha, Alright just making sure.
So what you wanna do is take the value from a textbox and put it into a .ini file? :O
If so,
Code: dim writer as new system.io.streamwriter(my.application.info.directorypath + "/map.ini")
writer.writer(textbox1.text)
writer.close
Posts: 50
Threads: 7
Joined: Dec 2010
Reputation:
0
well, exually
i want to put a value of a textbox in a part of a written text..
so if i put in 50 in an textbox, and i save it..
.. it will come into an .ini file in a kind of code.
but i don't know how i: save multiple textboxes, change text in an other text automaticly..
.. and a lot of stuff else, i can show you an example of it, if u want.
(i hope you are still following)
---------------------------------------
Earn money for all your games!
<!-- m --><a class="postlink" href="http://www.cashle.com/us/1936/Earn-money-for-all-y">http://www.cashle.com/us/1936/Earn-money-for-all-y</a><!-- m -->
our-games?ref=ekel
---------------------------------------
Posts: 1,006
Threads: 111
Joined: Jul 2010
Reputation:
1
Yes, I am still following.
But, Instead of writing in a certain section of the text file, wouldn't it just be easier to rewrite the whole text file??
If you would like to share your example that would be great!
Posts: 50
Threads: 7
Joined: Dec 2010
Reputation:
0
Hi again,
I've tried to upload the program, but it diddn't go well.
So I have created an print screen and uploaded it.
link : http://i.imgur.com/bzbTy.png
Img.:
I hope you understand now.
---------------------------------------
Earn money for all your games!
<!-- m --><a class="postlink" href="http://www.cashle.com/us/1936/Earn-money-for-all-y">http://www.cashle.com/us/1936/Earn-money-for-all-y</a><!-- m -->
our-games?ref=ekel
---------------------------------------
Posts: 245
Threads: 31
Joined: Sep 2010
Reputation:
0
Ill try and have a look at it ^^
Website: <!-- m --><a class="postlink" href="http://www.PBAProductions.com">http://www.PBAProductions.com</a><!-- m -->
E-Mail: <!-- e --><a href="mailto atrick@AriSystems.Org">Patrick@AriSystems.Org</a><!-- e -->
Skype: Qwaxer
Youtube: Qwaxer
Posts: 50
Threads: 7
Joined: Dec 2010
Reputation:
0
oh btw,
the numbers you saw in the map.ini file extualy had to be:
DepositTiming = 12000
DepositAmount = 200
InitialCaptureBonus = 1000
sorry <!-- s --><img src="{SMILIES_PATH}/icon_razz.gif" alt=" " title="Razz" /><!-- s -->
---------------------------------------
Earn money for all your games!
<!-- m --><a class="postlink" href="http://www.cashle.com/us/1936/Earn-money-for-all-y">http://www.cashle.com/us/1936/Earn-money-for-all-y</a><!-- m -->
our-games?ref=ekel
---------------------------------------
Posts: 1,006
Threads: 111
Joined: Jul 2010
Reputation:
1
Okay, well lets just assume that the textboxes are called capturebonus, normalbonus, and time.
Code: if my.computer.filesystem.fileexists(my.application.info.directorypath + "/map.ini") then
my.computer.filesystem.deletefile(my.application.info.directorypath + "/map.ini")
end if
dim writer as new system.io.streamwriter(my.application.info.directorypath + "/map.ini")
writer.write("Object TechOilDerrick" + vbNewLine + "ReplaceModule ModuleTag_04" + vbNewLine + "Behavior = AutoDepositUpdate ModuleTag_04_Override" + vbNewLine + "DepositTiming = " & time.text + "00" + vbNewLine + "DepositAmount = " + normalbonus.text + vbNewLine + "InitialCaptureBonus = " + capturebonus.text + vbNewLine + "End" + vbNewLine + "End" + vbNewLine + "End"
writer.close()
I think this is what you were looking for! <!-- s --><img src="{SMILIES_PATH}/icon_e_biggrin.gif" alt=" " title="Very Happy" /><!-- s -->
Posts: 50
Threads: 7
Joined: Dec 2010
Reputation:
0
You are a genius, thanks <!-- s --><img src="{SMILIES_PATH}/icon_e_biggrin.gif" alt=" " title="Very Happy" /><!-- s -->
---------------------------------------
Earn money for all your games!
<!-- m --><a class="postlink" href="http://www.cashle.com/us/1936/Earn-money-for-all-y">http://www.cashle.com/us/1936/Earn-money-for-all-y</a><!-- m -->
our-games?ref=ekel
---------------------------------------
Posts: 50
Threads: 7
Joined: Dec 2010
Reputation:
0
I finished the program almost,
but i have still ( ) a question:
I made a second tab in it for the rank settings.
and i added another change botton on that.
But if I save oil and then the rank. it will delete the map.ini file with the oil settings.
I want that it write's in the map.ini also the rank settings.
So if I press ONLY the Change button of the oil, only the oil settings will come in the map.ini
but if I press both the Change buttons, then the settings will be writed in the same map.ini
---------------------------------------
Earn money for all your games!
<!-- m --><a class="postlink" href="http://www.cashle.com/us/1936/Earn-money-for-all-y">http://www.cashle.com/us/1936/Earn-money-for-all-y</a><!-- m -->
our-games?ref=ekel
---------------------------------------
Posts: 1,006
Threads: 111
Joined: Jul 2010
Reputation:
1
So, I'm guessing you want to fix this?... Hold on, lemme do some research and I'll get back to ya. <!-- s --><img src="{SMILIES_PATH}/icon_e_biggrin.gif" alt=" " title="Very Happy" /><!-- s -->
Posts: 1,006
Threads: 111
Joined: Jul 2010
Reputation:
1
Hm. Well what you can do is ... Its kinda complicated but lets see if I can explain it.
Code: dim reader as new system.io.streamreader(my.application.info.directorypath + "/map.ini")
dim read as string = reader.readtoend
if read.contains("TechOilDerrick") then
my.computer.filesystem.deletefile(my.application.info.directorypath + "/map.ini")
'At this point you would need to write the RANK settings into the textfile, and somewhere in the writer options you MUST specify appendmode=true
'Then, when appendmode = true, you can then writer.write(read) and it will just add it to the end of the text file
end if
Now, I don't know how well this code would work, because I just came up with it off the top of my head, but it might give you a good idea.
Posts: 50
Threads: 7
Joined: Dec 2010
Reputation:
0
Sorry for my REALLY late response, but i was a bit bizzy.
I can't get it working, I don't understand all your codes. So I uploaded it on megaupload and you can download it here: <!-- m --><a class="postlink" href="http://www.megaupload.com/?d=HNMVPYYU">http://www.megaupload.com/?d=HNMVPYYU</a><!-- m -->
No virus ofcourse <!-- s --><img src="{SMILIES_PATH}/icon_e_biggrin.gif" alt=" " title="Very Happy" /><!-- s -->.
U can change it and upload it again or just tell me where the problem is.
Thanks for all.
---------------------------------------
Earn money for all your games!
<!-- m --><a class="postlink" href="http://www.cashle.com/us/1936/Earn-money-for-all-y">http://www.cashle.com/us/1936/Earn-money-for-all-y</a><!-- m -->
our-games?ref=ekel
---------------------------------------
Posts: 1,006
Threads: 111
Joined: Jul 2010
Reputation:
1
Alright, Well, in the file you uploaded, you didn't upload the source code so I can't edit it. So I will try my best here <!-- s --><img src="{SMILIES_PATH}/icon_e_smile.gif" alt=" " title="Smile" /><!-- s -->
OK. Step one. Declare this right under public class form1
Code: Public writer As New System.IO.StreamWriter(My.Application.Info.DirectoryPath + "/map.ini", True)
Step2 - make 13 settings, and name them capbonus,normalbonus,timebetween,rank1skill,rank2skill,rank3skill,rank4skill,rank5skill,rank1points,rank2points,rank3points,rank4points,rank5points.
-This may seem like alot. That's because it is.
Ok so when each button is pushed, you will change the settings to the corresponding textboxes. For example, when the oil setting is pushed, you will do this : Code: my.settings.capbonus = txt_capbonus.text
my.settings.normalbonus = txt_normalbonus.text
my.settings.timebetween = txt_timebetween.text
You will need to do the same thing with the rank tab.
Then, you will need to delete the text file when a button is pushed
Code: my.computer.filesystem.deletefile(my.application.info.directorypath + "/map.ini")
Then, you can write to the file. Simply replace all the spots where it gets a txtbox.text, with their corresponding settings. And make sure when you click one button, it writes both the rank and the oil settings.
Hope this helped!
Posts: 50
Threads: 7
Joined: Dec 2010
Reputation:
0
Hi again,
My computer has been hacked <!-- s:evil: --><img src="{SMILIES_PATH}/icon_evil.gif" alt=":evil:" title="Evil or Very Mad" /><!-- s:evil: -->,
but I had a backup of everything so it's fine now.
I'm working on an update function with a progressbar right now, because your information is a bit hard for me. <!-- s:oops: --><img src="{SMILIES_PATH}/icon_redface.gif" alt=":oops:" title="Embarrassed" /><!-- s:oops: --> still the overwriting is failing.
---------------------------------------
Earn money for all your games!
<!-- m --><a class="postlink" href="http://www.cashle.com/us/1936/Earn-money-for-all-y">http://www.cashle.com/us/1936/Earn-money-for-all-y</a><!-- m -->
our-games?ref=ekel
---------------------------------------
Posts: 1,006
Threads: 111
Joined: Jul 2010
Reputation:
1
Bah, I'm sorry to hear your computer got hacked and I'm doubly sorry to hear the coding isnt working out for you <!-- s --><img src="{SMILIES_PATH}/icon_e_sad.gif" alt=" " title="Sad" /><!-- s -->. We can help you with anything else though!
Posts: 50
Threads: 7
Joined: Dec 2010
Reputation:
0
I will upload it soon with source code <!-- s:!: --><img src="{SMILIES_PATH}/icon_exclaim.gif" alt=":!:" title="Exclamation" /><!-- s:!: -->
---------------------------------------
Earn money for all your games!
<!-- m --><a class="postlink" href="http://www.cashle.com/us/1936/Earn-money-for-all-y">http://www.cashle.com/us/1936/Earn-money-for-all-y</a><!-- m -->
our-games?ref=ekel
---------------------------------------
Posts: 1,006
Threads: 111
Joined: Jul 2010
Reputation:
1
Sweet. Can't wait to see <!-- s --><img src="{SMILIES_PATH}/icon_e_biggrin.gif" alt=" " title="Very Happy" /><!-- s -->
|