Android Question Beginner question - Code Module

dagodom

Member
Licensed User
Longtime User
Hello
I would like to break the code contained in main into various modules to maintain some order and cleanliness.
What are the basic rules for doing this?
Just define all the variables in process_globals and define the modules in "code modules"?
Are there any contraindications?

No, because I did tests and it doesn't seem to be enough.

For example the SQL variable is defined in Main in Process_Globals, but in the code module the variable is not seen.

Main :
Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
Dim SQL As SQL
....


Code module:
Sub search_par_num(vpar As String,vtype As String,vval As Int)
Dim Cursor1 As Cursor
Cursor1 = SQL.ExecQuery("SELECT * FROM na_config where co_par = '" & vpar & "'")
If Cursor1.RowCount == 0 Then
Dim tmps As String
tmps ="insert into na_config (co_par, co_type, co_val, co_desc) values ('"&vpar&"', '"&vtype&"',"&vval&",'')"
SQL.ExecNonQuery(tmps)
End If
End Sub
......

The same applies to the subroutine

Main:
Sub test_db

search_par_num("igf","N",0)
search_par_alfa("igl","A",0)
.....


What am I doing wrong ?

Thank you
 

mangojack

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

DonManfred

Expert
Licensed User
Longtime User
Upvote 0
Top