3 Replies - 3005 Views - Last Post: 28 January 2011 - 05:28 AM Rate Topic: -----

#1 OhWell63  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 12-January 11

Add spaces in a Label

Posted 27 January 2011 - 10:41 PM

I am trying to add spaces in the following label so the output reads - Sorry, your guess of 200 is too low. Guess Again. The code below outputs - Sorry, your guess of200is too low. Guess Again. As you can see this is not correct. Any advice would be great. Thanks!


 L2 = "Sorry, your guess of" & guess.ToString & "is too high. Guess again."

Is This A Good Question/Topic? 0
  • +

Replies To: Add spaces in a Label

#2 modi123_1  Icon User is online

  • Suitor #2
  • member icon



Reputation: 13493
  • View blog
  • Posts: 53,896
  • Joined: 12-June 08

Re: Add spaces in a Label

Posted 27 January 2011 - 10:44 PM

Put a space after 'of' and before the " and one before 'is' and after the other ".

L2 = "Sorry, your guess of " & guess.ToString & " is too high. Guess again."

Better yet, use the string.format.

L2 = string.format("Sorry, your guess of {0} is too high. Guess again.",guess)

Was This Post Helpful? 0
  • +
  • -

#3 OhWell63  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 12-January 11

Re: Add spaces in a Label

Posted 27 January 2011 - 11:05 PM

Funny I looked at that but did not have it coded right...thanks this worked!
Was This Post Helpful? 0
  • +
  • -

#4 Vishu Sukhdev  Icon User is offline

  • D.I.C Head

Reputation: 38
  • View blog
  • Posts: 150
  • Joined: 19-February 10

Re: Add spaces in a Label

Posted 28 January 2011 - 05:28 AM

You can also try this in simple way
L2 = "Sorry, your guess of " & guess.ToString & " is too high. Guess again."


Was This Post Helpful? 0
  • +
  • -

Page 1 of 1