IDE suddenly stops recognizing If.. else if syntax!

jvallee

New member
Joined
Feb 8, 2020
Messages
1
Programming Experience
Beginner
I have a function that has a series of if .. else if statements

It's ok thru the first eight but after that the IDE just THROWS UP! It stops recognzing If.. else if, the datarow and controls.. EVERYTHING!
It did work yesterday. But after closing and re-opening to resume work, I get this!

IDE.png
 

jmcilhinney

C# Forum Moderator
Staff member
Joined
Apr 23, 2011
Messages
2,616
Location
Sydney, Australia
Programming Experience
10+
By the way, your code is ridiculously verbose and actually inefficient. For one thing, you don't need any of those else if statements. Given that they all appear to test for the inverse condition, they should all just be else statements. Also, testing a Boolean condition and then using a Boolean literal on that basis can be condensed to simply using the original Boolean expression, e.g.
C#:
var req8Needed = dtrow.Field<string>("Req8Needed") == "Y";

R8Yes.Visible = req8Visible;
Req8No.Visible = !req8Visible;
On the efficiency front, you are only getting each field value once instead of twice. True, you probably wouldn't notice the difference but making your code harder to read and less efficient is not a great combination.
 
Last edited:
Top Bottom