Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Problems with multiple textboxes and coding
#1
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
---------------------------------------
#2
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 -->
My Blog | My Setup | My Videos | Have a wonderful day.
#3
yes, i have seen all your tutorials.





Btw: you said it was save, but it was more a save as <!-- sTongue --><img src="{SMILIES_PATH}/icon_razz.gif" alt="Tongue" title="Razz" /><!-- sTongue --> 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
---------------------------------------
#4
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
My Blog | My Setup | My Videos | Have a wonderful day.
#5
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
---------------------------------------
#6
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!
My Blog | My Setup | My Videos | Have a wonderful day.
#7
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.:[Image: bzbTy.png]
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
---------------------------------------
#8
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="mailtoTongueatrick@AriSystems.Org">Patrick@AriSystems.Org</a><!-- e -->
Skype: Qwaxer
Youtube: Qwaxer
[Image: 2hnx8av.jpg]
#9
oh btw,
the numbers you saw in the map.ini file extualy had to be:
DepositTiming = 12000
DepositAmount = 200
InitialCaptureBonus = 1000

sorry <!-- sTongue --><img src="{SMILIES_PATH}/icon_razz.gif" alt="Tongue" title="Razz" /><!-- sTongue -->
---------------------------------------
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
---------------------------------------
#10
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! <!-- sBig Grin --><img src="{SMILIES_PATH}/icon_e_biggrin.gif" alt="Big Grin" title="Very Happy" /><!-- sBig Grin -->
My Blog | My Setup | My Videos | Have a wonderful day.
#11
You are a genius, thanks <!-- sBig Grin --><img src="{SMILIES_PATH}/icon_e_biggrin.gif" alt="Big Grin" title="Very Happy" /><!-- sBig Grin -->
---------------------------------------
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
---------------------------------------
#12
I finished the program almost,
but i have still (Tongue) 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
---------------------------------------
#13
So, I'm guessing you want to fix this?... Hold on, lemme do some research and I'll get back to ya. <!-- sBig Grin --><img src="{SMILIES_PATH}/icon_e_biggrin.gif" alt="Big Grin" title="Very Happy" /><!-- sBig Grin -->
My Blog | My Setup | My Videos | Have a wonderful day.
#14
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.
My Blog | My Setup | My Videos | Have a wonderful day.
#15
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 <!-- sBig Grin --><img src="{SMILIES_PATH}/icon_e_biggrin.gif" alt="Big Grin" title="Very Happy" /><!-- sBig Grin -->.
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
---------------------------------------
#16
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 <!-- sSmile --><img src="{SMILIES_PATH}/icon_e_smile.gif" alt="Smile" title="Smile" /><!-- sSmile -->
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!
My Blog | My Setup | My Videos | Have a wonderful day.
#17
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
---------------------------------------
#18
Bah, I'm sorry to hear your computer got hacked and I'm doubly sorry to hear the coding isnt working out for you <!-- sSad --><img src="{SMILIES_PATH}/icon_e_sad.gif" alt="Sad" title="Sad" /><!-- sSad -->. We can help you with anything else though!
My Blog | My Setup | My Videos | Have a wonderful day.
#19
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
---------------------------------------
#20
Sweet. Can't wait to see <!-- sBig Grin --><img src="{SMILIES_PATH}/icon_e_biggrin.gif" alt="Big Grin" title="Very Happy" /><!-- sBig Grin -->
My Blog | My Setup | My Videos | Have a wonderful day.


Possibly Related Threads…
Thread Author Replies Views Last Post
  multiple csv files add sql server tables via VB.NET secilsengul 1 9,451 04-16-2014, 10:27 AM
Last Post: brco900033
  Problems with dividing a string brco900033 6 21,790 10-26-2013, 07:31 AM
Last Post: brco900033
  How to write string query on multiple lines kismetgerald 1 8,424 08-29-2012, 04:01 PM
Last Post: brandonio21
  VB.Net Query Builder Problems. Moldraxian 2 10,834 08-17-2012, 05:33 AM
Last Post: Moldraxian

Forum Jump:


Users browsing this thread: 1 Guest(s)