Android Question Word (arraylist) is showing up messagebox

anaylor01

Well-Known Member
Licensed User
Longtime User
Please take a look at the image and tell me how I can remove the (arraylist) and Brackets from the message box. The code is below.
B4X:
aList.Initialize()   
Dim cursor As Cursor
cursor=SQL1.ExecQuery("select TeamName from GamePlay")
For i = 0 To cursor.rowcount -1
cursor.position = i
aList.add(cursor.getstring("TeamName"))
Next
Msgbox(aList & " have tied.","Tie Game")
btngameplay.Text = "Team " & SQL1.ExecQuerySingleResult("SELECT  teamname FROM GamePlay where ID = '" & tid & "'") & " START"
 

Attachments

  • Array.png
    Array.png
    7.1 KB · Views: 233

mangojack

Well-Known Member
Licensed User
Longtime User
Last edited:
Upvote 0

anaylor01

Well-Known Member
Licensed User
Longtime User
Here is how I fixed it.
B4X:
Dim cursor As Cursor
Dim tienames As String
cursor=SQL1.ExecQuery("select TeamName from GamePlay")
For i = 0 To cursor.rowcount -1
cursor.position = i
tienames =  tienames & cursor.getstring("TeamName") & " and "
Next
tienames = tienames.SubString2(0,(tienames.Length -4))
Msgbox(tienames  & " have tied.","Tied Game")
 
Upvote 0

Mahares

Expert
Licensed User
Longtime User
You could have also used stringbuilder like this:
B4X:
Dim sb As StringBuilder
    sb.Initialize
    For i = 0 To cursor.rowcount -1
        cursor.position = i
        sb.Append(cursor.getstring("TeamName")).append(CRLF)
    Next
    Msgbox(sb.ToString,"Tied Teams")
 
Upvote 0
Top