Jump to content

string will not appear in label vb.net 2008

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
3 replies to this topic

#1
theBIGmac666

theBIGmac666

    Newbie

  • Members
  • Pip
  • 1 posts
i have a string variable called NamePlayer1 and another one called NamePlayer2, for a noughts and crosses game.

If one of the players win, i want do display the phrase "the winner is" and the sting variable.

i have tried this:
lblWinner.Text="the winner is" & NamePlayer1

this just returns the output "the winner is"

how can i change it so the variable is displayed too.

Edited by Roger, 07 December 2010 - 01:11 PM.
added code tags


#2
Alex3k

Alex3k

    Programmer

  • Members
  • PipPipPipPip
  • 109 posts
THat is the correct syntax however are you sure that NamePlayer1 actually has a value? check the code and see if you have assigned it one yet
Dreamspark really does "Spark Dreams"
---------------------------------------
View my Blog

#3
DarkDragon

DarkDragon

    Newbie

  • Members
  • Pip
  • 2 posts
have you tryed

 Dim NamePlayer1 As String = "Winwers name"

        lblWinner.Text = "the winner is " + NamePlayer1

Edited by Roger, 07 December 2010 - 01:11 PM.


#4
roxin_phoenix

roxin_phoenix

    Newbie

  • Members
  • PipPip
  • 19 posts
Hmm, thats weird... Maybe that variable didn't have value. But usually, I use + instead of &. Try to change it. :)