Android Tutorial Converting VB6 to B4A

BarrySumpter

Active Member
Licensed User
Longtime User

Nice!

instr() ?


Sub Instr(Text As String, TextToFind As String, Start As Int) As Int
Return text.IndexOf2(texttofind,start)
End Sub

 
Last edited:

BarrySumpter

Active Member
Licensed User
Longtime User
Beautiful!
Many thanks!

This is not working for me:
Out of Bounds
- in vb6 these were not 0 based arrays
and if the lenth wasn't provided it defaulted to the length/end of the text
B4X:
Sub Mid(Text As String, Start As Int, Length As Int) As String 
    If Len(Text) = 0 Then
        Return ""
    End If    
    Return Text.SubString2(Start-1,Start+Length-1)
End Sub
 
Last edited:

NeoTechni

Well-Known Member
Licensed User
Longtime User
I just got used to it being zero indexed.
and b4a sadly doesn't support optional parameters. I've been trying to get that changed but some guy keeps trying to change the subject to something completely different/inferior
 

BarrySumpter

Active Member
Licensed User
Longtime User
LOL.
If it's not the date n time driving me nuts.
Its the zero based stuff having to place -1 and +1 in just the right place.

Thanks for the heads up about the optional parameters.
I was wondering what all the msgbox2 and msgbox3 etc was for.

:sign0188:
 

jeffnooch

Member
Licensed User
Longtime User
in vb you could reference a control like
frmMain.controls("lblScoresP" & lbl.tag).text
can you do anything similar in b4a?
 

BarrySumpter

Active Member
Licensed User
Longtime User
Comming from vb6 myself,
I have not seen this control array indexing,
nor have I had need for it.

Although you can have say multiple buttons like on a calculator app with the same name
and use a special command (Sender)
to find out which button it was that fired the click routine.

hth
 
Last edited:

BarrySumpter

Active Member
Licensed User
Longtime User
anyone know the b4a for ubounds to find how many items are in an array?

for I = 1 to ubound(aryContact)
 

Djembefola

Active Member
Licensed User
Longtime User
B4X:
Dim aryContact(5) As String

For i = 1 to aryContact.length
...
 

BarrySumpter

Active Member
Licensed User
Longtime User
Yes please, as in:

POIs for Google Maps.
http://www.b4x.com/forum/basic4android-updates-questions/20503-poi-gooble-map-view.html#post118331

'Version 1.20
'With ScrollView2D

B4X:
...

Dim Table1, Table2 As Table


...
   
 Table1.LoadTableFromCSV(lblPath.Text, lblFileName.Text, True)

...
            For r = 0 To 1000    'Where is the .size for table
'            Log(r)
'            Log(Table1.GetValue(0, r))
'            Log(Table1.GetValue(1,r))
'            Log(Table1.GetValue(2,r))

                Location1.Initialize2(Table1.GetValue(1, r), Table1.GetValue(0, r))
'            Log(Location1.Latitude)
'                Log(Location1.Longitude)
'            
'                Log(Location1)

                LocationName = Table1.GetValue(2,r)

            'Log("myLoc: " & myLocationCircle.Contains(Location1))

                If myLocationCircle.Contains(Location1) Then
                      
                     Log("adding: " & r)
                     Table2.AddRow(Array As String(Location1.Latitude, Location1.Longitude, LocationName, True))
                    
                     Dim m As typMarker
                     m.Initialize
                     m.lat = Location1.Latitude
                     m.lng = Location1.Longitude
                     m.Name = LocationName
                     m.close = True
                     lstMarkers.Add(m)
                     
                    End If

            Next 
        Catch
            Log(LastException.Message)
        End Try


'    Table2.visible = True
'    Table1.visible = False

                     Table2.AddRow(Array As String("Done", "", "", ""))
 
Last edited:

mjas

Member
Licensed User
Longtime User
Hello I'm new here and my congratulations for the good work you made, and still making,with this B4A.
I understood that B4A is not the same as VB, is a kind of subset of it, but I have some issues here, and the most important is about manipulating arrays: wich methods, or functions exist in B4A to do it?
Ex: split strings to get an array / sort arrays / search values / convert arrays to strings (join?), and so on, like you have in VB?
:icon_clap: And found the undocumented keyword "Mod" like in Basic:
Mod (ex: x Mod y)

Thanks for any help.
:sign0098:
 

dreamniel22

New Member
Hello .
I was wondering how my app develop with VB6.0 can be an android app using Basic4android .. I dont know how to start .. Thank you Very much..
 

kamalkishor

Member
Licensed User
Longtime User
Problem with StateManager

hello...
i have included Reflection library but i am not able to access statemanger. I want to know that which kind of library support the StateManger .Any help is appreciated...








rgds.....
Kamal kishor
 

Kevin

Well-Known Member
Licensed User
Longtime User
hello...
i have included Reflection library but i am not able to access statemanger. I want to know that which kind of library support the StateManger .Any help is appreciated...

Kamal kishor

State Manager isn't a library, but rather it is a pre-made code module that you add to your project. Download the module, copy to your project's folder then in B4A add existing module to the project.

http://www.b4x.com/forum/basic4android-getting-started-tutorials/9777-statemanager-helps-managing-android-applications-settings-state.html#post54161
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…