B Oprit

B Oprit

  • 1.3k
  • 429
  • 4.1k

If statement based on text of label

Dec 16 2019 3:19 PM
I am trying to do stuff based on the Text of a label.
 
Normaly it is working in C# i think ? ? but not in Visual Studio 2019 Xamarin Forms
 
I tried placing () in diverent ways but no luck
 
The Labelname is Hoi , and want to do stuff when i push the button and the Text of the label is "BDN"(for example)
 
But Hoi.Text = "BDN" is not working
 
The error is Cannot implicitly convert 'string' to 'bool'
 
Syntax error , '(' expected
async void OnZienButtonClicked(object sender, EventArgs args)
{
if Hoi.Text = "BDN"
{
///// do stuff
}
else
{
}
 
I also asked the question here
https://forums.xamarin.com/discussion/175679/print-document-with-if-stament-based-on-picker-value#latest

Answers (2)