Search code examples
vb.netmessagebox

What is wrong with this msgbox code? (VB)


edit: Don't worry, i made a silly mistake, I had 3 characters instead of 4

   MessageBox.Show("Well done you completed the game in " & (Label4.Text.Substring(0, 2)) & ":" & (Label4.Text.Substring(2, 2)) & " milliseconds. Well Done!")

So why doesn't it work? If it helps, here is the error code:

"An unhandled exception of type 'System.ArgumentOutOfRangeException' occurred in mscorlib.dll

Additional information: Index and length must refer to a location within the string."


Solution

  • Can you tell me what exactly the 'Label4' contains, I know it has numbers, but what other text. Sorry for doing this as an answer but the 'Comment' button isn't anywhere on the page.