I was writing code but I got this error: Error 1 Cannot implicitly convert type 'string' to 'System.Windows.Forms.TextBox' C:\Users\McKinlays Laptop\AppData\Local\Temporary Projects\Spelling Activity\Form1.cs 26 28 Spelling Activity
Code:if (textBox2 = "thought") MessageBox.Show("Correct"); else MessageBox.Show("Incorrect");
the textBox2 is a text box, not a string, there for you can not assign to a text box a string.
Instead, the textBox has a "Text" property, to be exact, it's the text that it's displayed in the textBox.
Do it like this:
if (textBox2.Text == "thought") MessageBox.Show("Correct");
= is to assign
== is the equal operator.
Go to "View>>Properties" in Visual C# Express to see a control's properties.
Are you a newbie programmer trying to learn C#? Check out my small tutorial: Visual C# Programming Basics
Thank you so much!
This fixed it!
It also let me set up a basic login system for stuff![]()
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks