LOL Back again
If you need help with a project or need to know how to do something specific in VB.NET then please ask your questions in here.
Forum rules
Please LOCK your topics once you have found the solution to your question so we know you no longer require help with your query.
Please LOCK your topics once you have found the solution to your question so we know you no longer require help with your query.
people i know how to edit a textfile but how would i edit one line in a hole load so
the file is laied out like this
music:0.0
sound:0.0
invertYMouse:false
mouseSensitivity:0.2535211
fov:0.0
gamma:1.0
viewDistance:2
guiScale:0
particles:1
bobView:false
anaglyph3d:false
advancedOpengl:false
fpsLimit:100
difficulty:2
fancyGraphics:false
ao:false
clouds:false
skin:DokuCraft - The Saga Continues 1.2.5 - Light.zip
lastServer:
lang:en_US
and i want to replace the skin: (texturepack)
and that line only
the file is laied out like this
music:0.0
sound:0.0
invertYMouse:false
mouseSensitivity:0.2535211
fov:0.0
gamma:1.0
viewDistance:2
guiScale:0
particles:1
bobView:false
anaglyph3d:false
advancedOpengl:false
fpsLimit:100
difficulty:2
fancyGraphics:false
ao:false
clouds:false
skin:DokuCraft - The Saga Continues 1.2.5 - Light.zip
lastServer:
lang:en_US
and i want to replace the skin: (texturepack)
and that line only
Well, an easier way to seperate your items would be to end each one with ";" or another special character. It would look something like this:
music:0.0;sound0.0;blabla:bloblabli; , etc. Then, you could use the following code to edit that single item:
music:0.0;sound0.0;blabla:bloblabli; , etc. Then, you could use the following code to edit that single item:
Code: Select all
This should work splendidly ;)Dim str As String = My.Computer.ReadAllText("filename")
Dim list() As String = str.Split(";")
list(17)="New value" 'Keep in mind that the number 17 represents the order of that item in the list-1 (the index of the item). You can change it to any value between 0 and list.lengh-1 to control another item.
My.Computer.WriteAllText("filename", false)
If you need to keep the lines in the same format you can use this:
Code: Select all
Private Sub btnUpdate_Click(sender As System.Object, e As System.EventArgs) Handles btnUpdate.Click
Dim lines As String() = File.ReadAllLines("file.txt")
For i As Integer = 0 To lines.Length - 1
If lines(i).StartsWith("skin:") Then
lines(i) = "skin:test"
End If
Next
File.WriteAllLines("file.txt", lines)
End Sub
i need to get just the file name out of something soo C:/user/document/Texture.rar now all i want it the texture.rar section but need to take it from the textbox that says user blah blah my dad sujest using a instr function but i am unsure on how to use this does anyone else know how
The above sample shows how to edit one line.
You can get the skin value by adding this:
sujest using a instr functionYou would use the String.Remove function.
You can get the skin value by adding this:
Code: Select all
If lines(i).StartsWith("skin:") Then
Dim skin As String = lines(i).Remove(0, 5)
MsgBox(skin)
End If
hmm how to explain right well in mincraft the way it reads what texturepack to use it by looking in options and it says Skin:default and that will load the default soo my program moves the texturepack to the right folder at the min and to apply it i need it to take the text from a box that has is orginal location such as C:/users/muttley/document/newpack.zip and then take the text in the newpack.zip section and replace just the skin part of option with something like sking:newpack.zip so next time it is loaded it will load the new one but i have to do this inside one line of code so that it can be used in the same event as the move if you need more explenation ask and ill add you on skype and show you what i mean
Well, to get just the file.name part of a file, use this:
Code: Select all
Dim fullName As String="C:\Users\blah\blahblah\file.name"
Dim fileName As String= fullName.SubString(fullName.LastIndexOf("\")+1)
Comathi, wayy easier

Code: Select all
The full code would be
Dim FileName As String = System.IO.Path.GetFileName("C:\Users\You\Personal documents\Hidden documents\Secured documents\Hidden Images.zip")
Code: Select all
Private Sub btnUpdate_Click(sender As System.Object, e As System.EventArgs) Handles btnUpdate.Click
Dim skin As String = System.IO.Path.GetFileName(TextBox1.Text)
Dim lines As String() = File.ReadAllLines("file.txt")
For i As Integer = 0 To lines.Length - 1
If lines(i).StartsWith("skin:") Then
lines(i) = "skin:" + skin
End If
Next
File.WriteAllLines("file.txt", lines)
End Sub
LMAOSHMSFOAIDMT
Laughing my a** of so hard my sombrero fell off and I dropped my taco lmao;
Over 30 projects with source code!
Please give reputation to helpful members!
![Image]()
![Image]()
Laughing my a** of so hard my sombrero fell off and I dropped my taco lmao;
Over 30 projects with source code!
Please give reputation to helpful members!

I have finished it it is all ready would you like me to put it online or not people
Copyright Information
Copyright © Codenstuff.com 2020 - 2023