-
December 22nd, 2012, 01:18 PM
#1
[RESOLVED] Convert string to Bool
I have a windows form where I have a textbox that the user selects text from and then based on that text selection code will execute. I now need to set up a if statement that will if the user chooses "Airplane 1" from the textbox the code will change the name to "Alpha Airplane" or if the user selects "Airplane 2" from the textbox it changes the name to "Beta Airplane" I tried this code:
Code:
if (Names.Text = "Airplane 1")
Names.Text = "Alpha Airplane"
else
if (Names.Text = "Airplane 2")
Names.Text = "Beta Airplane"
But VS is throwing an error of Cannot implicitly convert type 'string' to 'bool' How can I do this?
-
December 22nd, 2012, 02:48 PM
#2
Re: Convert string to Bool
Another young learning mistake made by myself....instead of it being "=" it should have been "=="
Maybe this can help someone who comes across this post later on.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|