VB.Net help needed
Originally Posted by ManInCamo
i need to fix this nested IF statement.... WTF?
i have to use the if statement like this btw
i have to use the if statement like this btw
ex:
If Branch = "A" Then
branchout = "Army"
USA = USA + 1
If Rank = "P" Then
rankout = "Private"
ElseIf Rank = "L" Then
rankout = "Lieutenant"
Lt = Lt + 1
Else
rankout = "INVALID"
sw.WriteLine("Error in Rank Code")
errmsg = "Error in Record"
[possibliy EndIf here]
If Branch = "N" Then
branchout = "Navy"
USN = USN + 1
.....
or b. you just need to add the ElseIfs to when you're checking for the Branch.
ex:
If Branch = "A" Then
branchout = "Army"
USA = USA + 1
If Rank = "P" Then
rankout = "Private"
ElseIf Rank = "L" Then
rankout = "Lieutenant"
Lt = Lt + 1
Else
rankout = "INVALID"
sw.WriteLine("Error in Rank Code")
errmsg = "Error in Record"
[ElseIf] Branch = "N" Then
branchout = "Navy"
USN = USN + 1
.....
Hope this helps. if not my bad
ok, fixed the if statements , it needed to look like this:
ElseIf Branch = "F" Then
branchout = "AirForce"
USAF = USAF + 1
If Rank = "A" Then
rankout = "Airman"
ElseIf Rank = "M" Then
rankout = "Major"
Maj = Maj + 1
Else
rankout = "INVALID"
sw.WriteLine("Error in Rank Code")
errmsg = "Error in Record"
End If
ElseIf Branch = "M" Then
branchout = "Marines"
USMC = USMC + 1
If Rank = "G" Then
rankout = "General"
Gen = Gen + 1
ElseIf Rank = "C" Then
rankout = "Colonel"
Col = Col + 1
Else
rankout = "INVALID"
sw.WriteLine("Error in Rank Code")
errmsg = "Error in Record"
End If
End If
-------------------
now,however, my problemis that the first list box, lst1, is only displaying ONE of the personel files, i need ALL listed
ElseIf Branch = "F" Then
branchout = "AirForce"
USAF = USAF + 1
If Rank = "A" Then
rankout = "Airman"
ElseIf Rank = "M" Then
rankout = "Major"
Maj = Maj + 1
Else
rankout = "INVALID"
sw.WriteLine("Error in Rank Code")
errmsg = "Error in Record"
End If
ElseIf Branch = "M" Then
branchout = "Marines"
USMC = USMC + 1
If Rank = "G" Then
rankout = "General"
Gen = Gen + 1
ElseIf Rank = "C" Then
rankout = "Colonel"
Col = Col + 1
Else
rankout = "INVALID"
sw.WriteLine("Error in Rank Code")
errmsg = "Error in Record"
End If
End If
-------------------
now,however, my problemis that the first list box, lst1, is only displaying ONE of the personel files, i need ALL listed
Thread
Thread Starter
Forum
Replies
Last Post



