Mixed arrays and tables

noclass1980

Active Member
Licensed User
Longtime User
Hi, I have created a table with 9 columns and 20 rows. The first column contains text and all the other cells can only contain numbers. The user enters the numbers manually as required. I will ultimately put the table on a sliding panel so I can move between different panels. My question is:
will the data disappear from the table as I move between panels?
If they do, should I create an array to store the table data that can then be read into the table next time it is viewed during the same session?
If I need an Array, how do I create a mixed array for the text and numbers?

Thanks
 

noclass1980

Active Member
Licensed User
Longtime User
I've used the BetterSlidingPanels example from corwin42 and added a table programmatically to panel 1. I can enter data into the table and switch between panels and data remains in the table. Exactly what I wanted and no need for the array.
Would still like to know about the mixed arrays though if anyone has any suggestions?
Thanks
 
Upvote 0

Mahares

Expert
Licensed User
Longtime User
Would still like to know about the mixed arrays though if anyone has any suggestions?
You can declare a string array to include them all and then validate the values as shown below:
B4X:
Dimm MyVar() As String
MyVar=Array As String("London","1234","Sydney", "New York","906")
For i =0 To MyVar.Length-1
  If IsNumber(MyVar(i)) Then
      Msgbox(MyVar(i) & " is a number","NUMBER")
   Else
      Msgbox(MyVar(i) & " is text", "TEXT")
   End If
Next
 
Upvote 0

noclass1980

Active Member
Licensed User
Longtime User
You can declare a string array to include them all and then validate the values as shown below:
B4X:
Dimm MyVar() As String
MyVar=Array As String("London","1234","Sydney", "New York","906")
For i =0 To MyVar.Length-1
  If IsNumber(MyVar(i)) Then
      Msgbox(MyVar(i) & " is a number","NUMBER")
   Else
      Msgbox(MyVar(i) & " is text", "TEXT")
   End If
Next
Many thanks, that is clear.
 
Upvote 0
Top