>>string selValue = this.lsbUsers.SelectedItem.ToString(); >>>>
>>string selValue = this.lsbUsers.SelectedItem.Text.ToString(); >>>
>String selValue = this.lsbUsers.SelectedValue.ToString() ; > > bool TestUser = (String.IsNullOrEmpty(selValue)); > String selText = this.lsbUsers.Text.ToString(); > bool TestUserText = String.IsNullOrEmpty(selText); > String SelRole = this.LsbRoles.SelectedValue.ToString(); > bool TestRole = String.IsNullOrEmpty(SelRole) ; > > //if ((!this.lsbUsers.SelectedItem != null && this.lsbUsers.Text != string.Empty) > // && this.LsbRoles.SelectedValue != null) > if (TestUser == false && TestUserText == false && TestRole == false)Aside from Paul's comments I see nothing wrong, If it's easily readable, it's all that matters
string s = 'abc'; var xx = s.IsNullOrEmpty(); s = null xx = s.IsNullOrEmpty(); // error I think