F fabio.mevoli Member Licensed User Jul 11, 2025 #1 I'm new in B4I I write: #if B4A If area2(area2.Length-2) = 1 Then Model_box.Text = "W480" Type_box.Text = "DSC-MOB-C" Else Model_box.Text = "W480" Type_box.Text = "DSC-MOB-O" End If #Else If B4I If area2(area2.Length-2) = 1 Then Model_box.Text = "W480" Type_box.Text = "DSC-MOB-C" Else Model_box.Text = "W480" Type_box.Text = "DSC-MOB-O" End If #End If In B4I I got an error: EXPECTED NON CODE BLOCK, but with B4A everthings works well.
I'm new in B4I I write: #if B4A If area2(area2.Length-2) = 1 Then Model_box.Text = "W480" Type_box.Text = "DSC-MOB-C" Else Model_box.Text = "W480" Type_box.Text = "DSC-MOB-O" End If #Else If B4I If area2(area2.Length-2) = 1 Then Model_box.Text = "W480" Type_box.Text = "DSC-MOB-C" Else Model_box.Text = "W480" Type_box.Text = "DSC-MOB-O" End If #End If In B4I I got an error: EXPECTED NON CODE BLOCK, but with B4A everthings works well.
aeric Expert Licensed User Longtime User Jul 12, 2025 #2 Please use code tags when posting on forum e.g [code]#If B4A #Else If B4i #End If[/code] By the way, the code is same for both conditions. You don't need to use #If B4A etc. Upvote 0
Please use code tags when posting on forum e.g [code]#If B4A #Else If B4i #End If[/code] By the way, the code is same for both conditions. You don't need to use #If B4A etc.
hatzisn Expert Licensed User Longtime User Jul 12, 2025 #3 fabio.mevoli said: I'm new in B4I I write: #if B4A If area2(area2.Length-2) = 1 Then Model_box.Text = "W480" Type_box.Text = "DSC-MOB-C" Else Model_box.Text = "W480" Type_box.Text = "DSC-MOB-O" End If #Else If B4I If area2(area2.Length-2) = 1 Then Model_box.Text = "W480" Type_box.Text = "DSC-MOB-C" Else Model_box.Text = "W480" Type_box.Text = "DSC-MOB-O" End If #End If In B4I I got an error: EXPECTED NON CODE BLOCK, but with B4A everthings works well. Click to expand... I suppose area2 is an array. I cannot understand why is this happening. This is a long shot but you may have to use lower case letters in the '#' statements. B4X: #if b4a #else if b4i #end if Upvote 0
fabio.mevoli said: I'm new in B4I I write: #if B4A If area2(area2.Length-2) = 1 Then Model_box.Text = "W480" Type_box.Text = "DSC-MOB-C" Else Model_box.Text = "W480" Type_box.Text = "DSC-MOB-O" End If #Else If B4I If area2(area2.Length-2) = 1 Then Model_box.Text = "W480" Type_box.Text = "DSC-MOB-C" Else Model_box.Text = "W480" Type_box.Text = "DSC-MOB-O" End If #End If In B4I I got an error: EXPECTED NON CODE BLOCK, but with B4A everthings works well. Click to expand... I suppose area2 is an array. I cannot understand why is this happening. This is a long shot but you may have to use lower case letters in the '#' statements. B4X: #if b4a #else if b4i #end if
F fabio.mevoli Member Licensed User Jul 14, 2025 #4 Another strange thing one rerror highlighted is in English and one is in Italian. Array definition: #If B4A Private area1(11) As Byte Private area2(32) As Byte #Else If B4I #Else If B4I Public area1() As Byte area1 = Array As Byte(0,0,0,0,0,0,0,0,0,0,0) Public area2() As Byte area2 = Array As Byte(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0) #End If Attachments b4i_1png.png 129.7 KB · Views: 312 b4i_2png.png 129.3 KB · Views: 308 Upvote 0
Another strange thing one rerror highlighted is in English and one is in Italian. Array definition: #If B4A Private area1(11) As Byte Private area2(32) As Byte #Else If B4I #Else If B4I Public area1() As Byte area1 = Array As Byte(0,0,0,0,0,0,0,0,0,0,0) Public area2() As Byte area2 = Array As Byte(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0) #End If
aeric Expert Licensed User Longtime User Jul 14, 2025 #5 B4X: Sub Class_Globals Private Root As B4XView Private xui As XUI Private area1(11) As Byte Private area2(32) As Byte End Sub B4X: area1 = Array As Byte(0,0,0,0,0,0,0,0,0,0,0) area2 = Array As Byte(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0) You don't need to use conditional symbols. Upvote 0
B4X: Sub Class_Globals Private Root As B4XView Private xui As XUI Private area1(11) As Byte Private area2(32) As Byte End Sub B4X: area1 = Array As Byte(0,0,0,0,0,0,0,0,0,0,0) area2 = Array As Byte(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0) You don't need to use conditional symbols.