bcavender Posted July 21, 2020 Report Share Posted July 21, 2020 C# Noob Error - I've tried adding semicolons and searched examples trying to figure this basic error out for an hour, but can't figure out how to clear the two CS1002 errors. Need an experienced eye that sees what I am missing ... maybe a suggestion of a resource to study to get up to speed. Thank You! B Quote Link to comment Share on other sites More sharing options...
Jerry Medved Posted July 21, 2020 Report Share Posted July 21, 2020 elseif is not vaild. should be: else if Quote Link to comment Share on other sites More sharing options...
bcavender Posted July 21, 2020 Author Report Share Posted July 21, 2020 Fixed that, but the change added an 'else' error to the list ... I have got to be missing something really dead dumb simple here ... Quote Link to comment Share on other sites More sharing options...
Jerry Medved Posted July 21, 2020 Report Share Posted July 21, 2020 please post the text vs image Quote Link to comment Share on other sites More sharing options...
bcavender Posted July 21, 2020 Author Report Share Posted July 21, 2020 (edited) public void MainCalculation() { If (HMA_Line[1]>HMA_Line) { SetColorAndShape(SysColor.MainIndicator3, PBShape.ArrowDn); TriggerAlert("HMA10Down", @"HMA10Down"); return; } else if (HMA_Line[1]<HMA_Line) { SetColorAndShape(SysColor.MainIndicator2, PBShape.ArrowUp); TriggerAlert("HMA10Up", @"HMA10Up"); return; } } Edited July 21, 2020 by bcavender Quote Link to comment Share on other sites More sharing options...
Jerry Medved Posted July 21, 2020 Report Share Posted July 21, 2020 the first IF - you have the I capitalized. should be just "if" - lower case Quote Link to comment Share on other sites More sharing options...
bcavender Posted July 21, 2020 Author Report Share Posted July 21, 2020 I knew C# was case sensitive, but my reading had seen stuff like this that used upper case "If" ... but use lower case in real code. Knew this had to be something simple. The semicolon error was a pretty good distraction ... Thank you for your good help ... I would have wasted a lot more time on this nuance without your assist. Best regards, B Quote Link to comment Share on other sites More sharing options...
Mike Medved Posted July 22, 2020 Report Share Posted July 22, 2020 Yeah I checked again and the semicolon error is what the compiler in MT returns on that code. Visual Studio's C# returns both the semicolon error and the unknown identifier on If error. Quote Link to comment Share on other sites More sharing options...
bcavender Posted July 22, 2020 Author Report Share Posted July 22, 2020 Thanks Mike! That one really had me scratching my head ... LOL! Appreciate your good help!!! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.