none
"The left-hand side of an assignment must be a variable, property or indexer". Help?

    Question

  • private void webBrowser1_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
    {
     webBrowser1.Url.ToString() = Frios.Properties.Settings.Default.Home.ToString();
    }

    "The left-hand side of an assignment must be a variable, property or indexer"
    Saturday, January 22, 2011 1:46 AM

Answers

  • You're doing this:

     

    webBrowser1.Url.ToString()


    However, the ToString() method turns this into a string - you can't use that on the left side of an = statement.

     

    Since WebBrowser.Url is set via a Uri, you need to make a Uri class.  Try the following:

     

    private void webBrowser1_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
    {
      webBrowser1.Url = new Uri(Frios.Properties.Settings.Default.Home.ToString());
    }
    

     

    The difference is you're making a Uri instance on the right side, and setting it directly to the Url property on the left.

     


    Reed Copsey, Jr. - http://reedcopsey.com
    If a post answers your question, please click "Mark As Answer" on that post and "Mark as Helpful".
    • Proposed as answer by felipet Saturday, January 22, 2011 5:15 AM
    • Marked as answer by Mio_Miao Saturday, February 05, 2011 11:14 AM
    Saturday, January 22, 2011 2:06 AM
    Moderator

All replies

  • You're doing this:

     

    webBrowser1.Url.ToString()


    However, the ToString() method turns this into a string - you can't use that on the left side of an = statement.

     

    Since WebBrowser.Url is set via a Uri, you need to make a Uri class.  Try the following:

     

    private void webBrowser1_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
    {
      webBrowser1.Url = new Uri(Frios.Properties.Settings.Default.Home.ToString());
    }
    

     

    The difference is you're making a Uri instance on the right side, and setting it directly to the Url property on the left.

     


    Reed Copsey, Jr. - http://reedcopsey.com
    If a post answers your question, please click "Mark As Answer" on that post and "Mark as Helpful".
    • Proposed as answer by felipet Saturday, January 22, 2011 5:15 AM
    • Marked as answer by Mio_Miao Saturday, February 05, 2011 11:14 AM
    Saturday, January 22, 2011 2:06 AM
    Moderator
  • I have a similar issue and I'm sure it didn't throw this error before?

    public string CharacterName
            {
                get
                {
                    NameOffset = null;
                    int NameAddress = Dbg.ReadInt32(BaseAddress + NameOffset);
                    return Dbg.ReadString(NameAddress, 16);
                }
            }

    private const int NameOffset = 0x62BAD30;

    Thursday, May 10, 2012 6:42 PM
  • In this case, it looks like NameOffset is a constant.  You can't change it!  Also since it is an int, you can't assign null to it anyway!  Perhaps you should provide some more code.  These should not be able to compile.
    Thursday, May 10, 2012 10:00 PM
  • Ok well I've scrapped this for a better code except it ALSO has errors which I have posted, if I try to compile the newer code I get 20 errors and if I leave the code then I get 32 errors >.< What a nightmare lol.

    I sincerely appreciate the replies and help :)

    • Edited by WHITELIONX Thursday, May 10, 2012 10:28 PM
    Thursday, May 10, 2012 10:27 PM