Windows Phone Developers

Wednesday, January 7, 2009

The left-hand side of an assignment must be a variable, property or indexer

The left-hand side of an assignment must be a variable, property or indexer

Assignment in conditional expression is always constant; did you mean to use == instead

The error mostly pops when a VB programmer codes in C#.

To fix this error, make sure that all operators are on the right-hand side and that the left-hand side is a variable, property, or indexer. Use == for checking values instead of ‘=’

if (String.IsNullOrEmpty(s1) == true)

instead of

if (String.IsNullOrEmpty(s1) = true)



Digg Technorati Delicious StumbleUpon Reddit BlinkList Furl Mixx Facebook Google Bookmark Yahoo
ma.gnolia squidoo newsvine live netscape tailrank mister-wong blogmarks slashdot spurl StumbleUpon

3 comments:

  1. same pr plz help


    Error 2 The left-hand side of an assignment must be a variable, property or indexer

    conatinate two list box item

    my code
    lboxhr.SelectedItem.Text + " '" + LBoxmin.SelectedItem.Text + " ' " + LBoxdy.SelectedItem = dr["strInstime"].ToString();

    ReplyDelete
  2. @Bajaj. Are you trying to store the selected item to a textbox or string

    IF that is the case please try
    Dim sText as string = lboxhr.SelectedItem.Text + " '" + LBoxmin.SelectedItem.Text + " ' " + LBoxdy.SelectedItem

    If it is not clear can you please explain a bit

    ReplyDelete

kbAlertz.com :: Visual Studio 2005

kbAlertz.com :: Visual Studio 2008

kbAlertz.com :: Visual Basic 2005