I need a solution to my current code, I am trying to save text to a file from a Text Box, and add a string to it. My following code is:
Dim fs As FileStream = File.Create(fileName.Text)
' Add text to the file.
Dim info As Byte() = New UTF8Encoding(True).GetBytes(CodeBox.Text)
Dim Code = "-- Made with LUA Creator by Sam v1.9
" + info
fs.Write(Code, 0, Code.Length)
fs.Close()
MsgBox("File saved as " + fileName.Text)
But Visual Studio says that I cannot use "+" operator with strings & bytes:
Error BC30452 Operator '+' is not defined for types 'String' and 'Byte()'.
Anyone have a solution? Sorry if this is a duplicate, I couldn't find it anywhere here so I just asked myself. Thanks.
&is for string concatenation;+is for addition. Try concatenating your string with the TextBox, before usingGetBytes:"-- Made with..." & CodeBox.Text)