Head/Tail and Left/Right CrossWind Widget

harry5568

Member
Hello...I'm an absolute newbie in Programming.Been looking at basic4ppc last couple of days and found it quite interesting. A few of you have been very kind to Help too.
I made a small prog for Aviation enthusiasts.I'm an Airbus Pilot and it helps me find the correct wind component to calculate my Aircraft's Performance for Landing/TakeOff. Hope it helps at least one of you!
Of course,its very basic for most of you.

Cheers...Harinder(Harry)
 

Attachments

  • WindWidget.sbp
    2.6 KB · Views: 318

agraham

Expert
Licensed User
Longtime User
Good habits are best established early in programming (as in life!)

I haven't changed your actual code at all but look how the use of tabs to indent lines reveals the structure in the code and makes it easier to read, particularly when you have nested constructs like Sub/End Sub, If/End If, For/Next, Do/While. You can adjust the amount of indent in the IDE for each tab character by Tools -> IDE Options -> TabSize

B4X:
Sub headortail
   a=ComboBox1.Text
   b = TextBox1.Text
   c = Num1.Text
   e=Cos(((a*10)-b)*(22/(7*180)))*c
   If  Round(e)<0 Then
      Label11.FontColor= cRed
      Label2.FontColor= cRed
      Return "TAIL"
   Else If Round(e)=0 Then
      Return " "
   Else
      Label11.FontColor= cBlack
      Label2.FontColor= cBlack
      Return "HEAD"
   End If
End Sub

Another tip. Unless you need to return a string with a space character as in the code above you can just use Return on it's own which does in fact return an empty string.
 
Top