Parameter name cannot hide global variable name

roarnold

Active Member
Licensed User
Longtime User
Erel,

Something I noticed also during compile is hiding of global variables. For instance -http://www.b4x.com/android/wiki/index.php?title=CheckBox&action=edit- referencing this text on CheckBoxes I get this error. I placed the variables where told and still receive this error.

Bit confused.

When I get this error I have to accomplish a work around which may not be the optimum way to accomplish the feat nor at times does it seem to work out.

Thoughts?

Thanks,
Ron
 

roarnold

Active Member
Licensed User
Longtime User
IF I DIM result As String, then run it through a sub to pick up data from a server via php or whatever I can't go to another sub called parse using (result) to pass the data say to json even if it is declared in the sub globals? It is actually declared in the Main activity and passed to another activity via (Main.result).

I think I found the problem though in my code. I had declared it in the main activity process globals as I said but inadvertently also declared it in the second activity in sub global. I deleted the second one and all appears fine.

Appreciate the help.

Ron
 
Upvote 0

Itila Tumer

Active Member
Licensed User
Longtime User
I use SQLight2 , and there is a webview and I 'd like to use that another activity but , It give the same error

Parameter name cannot hide global variable name

B4X:
Sub ExecuteHtml(SQL As SQL, Query As String, StringArgs() As String, Limit As Int, Clickable As Boolean) As String
    Dim cur As Cursor
    If StringArgs <> Null Then
        cur = SQL.ExecQuery2(Query, StringArgs)
    Else
        cur = SQL.ExecQuery(Query)
    End If
    Log("ExecuteHtml: " & Query)
    If Limit > 0 Then Limit = Min(Limit, cur.RowCount) Else Limit = cur.RowCount
    Dim sb As StringBuilder
    sb.Initialize
    sb.Append("<html><body>").Append(CRLF)
    sb.Append("<style type='text/css'>").Append(HtmlCSS).Append("</style>").Append(CRLF)
    sb.Append("<table><tr>").Append(CRLF)
    For i = 0 To cur.ColumnCount - 1
        sb.Append("<th>").Append(cur.GetColumnName(i)).Append("</th>")
    Next
   
    sb.Append("</tr>").Append(CRLF)
    For row = 0 To Limit - 1
        cur.Position = row
        If row Mod 2 = 0 Then
            sb.Append("<tr>")
        Else
            sb.Append("<tr class='odd'>")
        End If
        For i = 0 To cur.ColumnCount - 1
            sb.Append("<td>")
            If Clickable Then
                sb.Append("<a href='http://").Append(i).Append(".")
                sb.Append(row)
                sb.Append(".com'>").Append(cur.GetString2(i)).Append("</a>")
            Else
                sb.Append(cur.GetString2(i))
            End If
            sb.Append("</td>")
        Next
        sb.Append("</tr>").Append(CRLF)
    Next
    cur.Close
    sb.Append("</table></body></html>")
    Return sb.ToString
End Sub
B4X:
wbvTable.LoadHtml(Denek.ExecuteHtml(Activity2.SQL1, Query, Null, 0, True))
    ReadDataBaseIDs
 
Upvote 0
Top