Hi team! I'm beginner in xamarin's projects. So please be patient with me. Ι want to check if textview is null or empty.I'm using this code but it doesnt work.
TextView textview2 = FindViewById<TextView>(Resource.Id.textView2); TextView textview1 = FindViewById<TextView>(Resource.Id.textView1); if (textview1 != null) { textview2.Text = "123"; } else { }
Either of these will work...
if (textview1.Text == "" || textview1.Text == null) { textview2.Text = "123"; } else { } if (string.IsNullOrEmpty(textview1.Text)) { textview2.Text = "123"; } else { }
Cheers!
Answers
try this:
Operator '||' cannot be applied to operands of type 'string' and 'bool' App1
Either of these will work...
Cheers!