• Need some VB help
    5 replies, posted
Just started today, but I've gotten really far. I need to know how to break a string in two. It's hard to explain but it would be the equivalent to htmls<br> except in a message box. I know for a fact I'm doing something wrong. The dims could probably be sorted a more efficient way but I don't know anything about arrays. [code] Dim Hallywood As Integer Dim Hallygold As Integer Dim hallyfood As Integer Dim Hallyoppe As Integer Dim hallypop As Integer Hallygold = txtNumbers.Text * 5 Hallywood = txtNumbers.Text * 10 MessageBox.Show("Wood=" + Hallywood.ToString + "Gold=" + Hallygold.ToString) [/code] This would display in a Pop up message box like this: Wood=xGold=x I want it to be like this: Wood=x Gold=x Etc.. I would really appreciate the help!
\n is a character for new line. Put it in a string where you want to break it like for example "Apples\nBananas" would output: Apples Bananas
If \n doesnt work, try Environment.NewLine.
Or vbCrlf, if that's still around :v:
I always use vbCrLf, it will work. (also, you might want to use & instead of +, makes it easier to see if you're handling strings or numbers)
\r\n
Sorry, you need to Log In to post a reply to this thread.