Closed Thread
Results 1 to 3 of 3

Thread: Code

  1. #1
    JakeWindu is offline Newbie
    Join Date
    Nov 2009
    Posts
    21
    Rep Power
    0

    Code

    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");

  2. CODECALL Circuit advertisement
    Join Date
    Always
    Posts
    Many

     
  3. #2
    Davide's Avatar
    Davide is offline Programming God
    Join Date
    Dec 2009
    Location
    Manchester, UK
    Posts
    507
    Blog Entries
    8
    Rep Power
    11

    Re: Code

    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

  4. #3
    JakeWindu is offline Newbie
    Join Date
    Nov 2009
    Posts
    21
    Rep Power
    0

    Re: Code

    Thank you so much!

    This fixed it!

    It also let me set up a basic login system for stuff

Closed Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Problem in a href location from php code to html code
    By newphpcoder in forum PHP Development
    Replies: 5
    Last Post: 05-13-2011, 02:03 PM
  2. how to make a bar code reader program in VB 2008 please send me the code
    By tontonskie in forum Visual Basic Programming
    Replies: 1
    Last Post: 11-15-2010, 12:58 AM
  3. add code for font size under php echo code
    By newphpcoder in forum PHP Development
    Replies: 2
    Last Post: 11-10-2010, 11:03 PM
  4. Code: Capture Code from USB Camera
    By MrNobody in forum Visual Basic Tutorials
    Replies: 71
    Last Post: 08-14-2009, 08:59 AM
  5. Code: Capture Code from USB Camera
    By MrNobody in forum Tutorials
    Replies: 5
    Last Post: 09-08-2007, 06:00 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts