Announcement

Collapse
No announcement yet.

MLG Questions

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • MLG Questions

    Hello,

    How do I read selected Grid row to TextBoxes?

    Here is an attempt. Obviously not doing the job.

    Code:
    Case %WM_NOTIFY
              MLGN=CbLParam        
              If @MLGN.NMHeader.idFrom = %ID_FORM1_USERCONTROL1 Then' Notification messages
              Select Case @MLGN.NMHeader.Code  '
                  Case %MLGN_ROWSELCHANGE  
                  mystart=@MLGN.Param1 'start row
                  myend=@MLGN.Param2 
                  MLG_GetEx global_hGrid1,ByRef sArray() 
                  For x= 1 To 5
                     sRecordNo = sArray(x,1)  
                     slSEL "SELECT RowID as RecordNo, * FROM tblUsers WHERE RecordNo  = '" + sRecordNo + "'"
                     If IsTrue slGetRow Then
                       
                       Control Set Text nCbHndl, %ID_FORM1_TEXT1, slFN("Surname")
                      
                   End If  
                   
                   slCloseSet
                   Next x
              End Select
              End If
    Glad to get any pointers.

    Kind regards,
    Fredrick Ughimi
    www.meganetsoft.com

  • #2
    slSel gets from SQLitening not MLG.

    In the help file under Internal Functions:
    DIM s(FirstRow to LastRow,FirstCol to LastCol)
    MLG_GetEx hGrid,s()
    https://www.tesla.com/roadster

    Comment


    • #3
      In help file under Activating:
      There are six examples of reading from a cell or rows.
      Followed by six examples of writing to the grid.
      https://www.tesla.com/roadster

      Comment


      • #4
        Hello Mike,

        >>slSel gets from SQLitening not MLG

        Sure. I know.

        >>In the help file under Internal Functions...

        Not giving me what I want. The values read to the Textbox doesn't change even when I select a different row. Doesn't even respect selected row in the first place. Maybe I am using the wrong notification (%MLGN_ROWSELCHANGE)?

        For instance:

        Code:
        Case %WM_NOTIFY
                  MLGN=CbLParam        
                  If @MLGN.NMHeader.idFrom = %ID_FORM1_USERCONTROL1 Then' Notification messages
                  Select Case @MLGN.NMHeader.Code  '
                      Case %MLGN_ROWSELCHANGE  
                      mystart=@MLGN.Param1 'start row
                      myend=@MLGN.Param2 
                      Dim sArray(1 To 200,1 To 50) 
                      MLG_GetEx global_hGrid1,sArray()
                      Control Set Text nCbHndl, %ID_FORM1_TEXT1, sArray(1, 5) 
                  End Select
                  End If
        Last edited by Fredrick Ughimi; 7 Sep 2015, 02:17 AM. Reason: Close Tag Properly
        Fredrick Ughimi
        www.meganetsoft.com

        Comment


        • #5
          Might write a helper function.
          Someone with more experience should have a better way.
          This fires after selecting any cell in a new row.
          The GetData function I added should only be called after buttonup selecting rows so should be fixed.

          I copied MLGDEMO.BAS to TEST.BAS and applied the code below to it.

          For any lurkers, MLG is extremely fast compared to many grids.
          I will be incorporating it with programs to replace code that isn't nearly as quick.
          SQLitening has options to use 2 dimensional arrays so it should work extremely well with it.
          Code:
           CASE %WM_NOTIFY
             MLGN=CBLPARAM
             IF @MLGN.NMHeader.idFrom = %IDC_MLGGRID1 THEN
               SELECT CASE @MLGN.NMHeader.code            
                   CASE %MLGN_ROWSELCHANGE  'sent after buttonup if whole row/rows selected
                     GetData MLGN 
               END SELECT
             END IF
          Code:
          FUNCTION GetData(BYVAL MLGN AS MYGridData PTR) AS STRING
           
            LOCAL StartRow,EndRow,Totrows,Totcols AS LONG, s AS STRING
            StartRow=@MLGN.Param1 'start row
            EndRow=@MLGN.Param2 'end row
            SendMessage(hGrid1,%MLG_GETROWCOLTOTEX,VARPTR(totrows),VARPTR(totcols))
            DIM sdata(StartRow TO EndRow,1 TO totCols) AS STRING
            MLG_GetEx hGrid1,sdata()
            
           
          'Pull out wanted data
          'LOCAL r,c AS LONG
          'FOR r = StartRow TO EndRow
          ' FOR c = 1 TO TotCols
          ' s+= sdata(r,c) + ","
          ' NEXT
          ' ASC(s,LEN(s)) = 13
          'NEXT
          'FUNCTION = s
          END FUNCTION
          Last edited by Mike Doty; 7 Sep 2015, 05:14 AM.
          https://www.tesla.com/roadster

          Comment


          • #6
            Hello Mike,

            Thank you for the sample code.

            Though I have not been able to make it work for me. When I tried to 'pull out the wanted data' the structure (Field Names) was displayed instead.

            Would try some further tweaking.

            Best regards,
            Fredrick Ughimi
            www.meganetsoft.com

            Comment


            • #7
              Please only click in column 0 of row 1.
              See if it returns the data contained in row 1.
              https://www.tesla.com/roadster

              Comment


              • #8
                This returns rows marked when mouse button is released.
                Mouse must be in column 0 and mouse pointer is pointing right.

                Column 1 is being marked and unmarked so something is wrong.
                Need an experienced MLG person.

                Code:
                 FUNCTION GetData(BYVAL MLGN AS MYGridData PTR) AS STRING
                 
                  LOCAL StartRow,EndRow,Totrows,Totcols AS LONG, s AS STRING
                 
                  SendMessage(hGrid1,%MLG_GETROWCOLTOTEX,VARPTR(totrows),VARPTR(totcols))
                  StartRow=@MLGN.Param1    'start row
                  EndRow=@MLGN.Param2      'end row
                  IF StartRow < 1 THEN EXIT FUNCTION
                 
                  DIALOG SET TEXT ghDlg, USING$("Start row #  End row #",StartRow,EndRow)
                  DIM sData(StartRow TO EndRow, 0 TO totCols) AS STRING  'including column 0
                  MLG_GetEx hGrid1,sdata()
                  LOCAL r,c AS LONG
                  FOR r = StartRow TO EndRow  'lbound(sdata(1) to ubound(sdata(1))
                    FOR c = 0 TO totcols      'lBOUND(sData(2)) to ubound(sdata(2))
                      s+= sdata(r,c) + ","
                    NEXT
                    ASC(s,LEN(s)) =  13
                  NEXT
                  FUNCTION = s
                  ? s,,FUNCNAME$
                END FUNCTION
                https://www.tesla.com/roadster

                Comment


                • #9
                  If a cell is a checkbox, the checkbox is in a checked state if the cell contents has a string length greater than zero.

                  Jim

                  Comment


                  • #10
                    Clicking on column 0 checks/unchecks column 1.
                    I need to study how to handle click on column 0.
                    https://www.tesla.com/roadster

                    Comment


                    • #11
                      Clicking on a row, by default, selects the first column cell in that row - which is what excel does. A similar behavior results for a column selection. In the case of a checkbox being at the new selection location is problematic. I did not built the logic to test for a checkbox being at this row selection location.

                      When a box row selection has occured, a %MLGN_ROWSELCHANGE notification is triggered. You can clean up the problems with a checkbox being in column 1 by putting any character into the cell (like "X") and calling refresh in the notification handler part of your code.

                      Hope that helps
                      Jim

                      Comment


                      • #12
                        Yes, thank you!
                        I was using the mlgdemo for testing.
                        https://www.tesla.com/roadster

                        Comment


                        • #13
                          Thanks Mike

                          Hello Mike,

                          You last GetData() code works great.

                          It would also be nice to read each field and place in Textboxes.

                          Thanks a lot.
                          Fredrick Ughimi
                          www.meganetsoft.com

                          Comment


                          • #14
                            Code:
                             FUNCTION GetData(BYVAL MLGN AS MYGridData PTR) AS STRING
                             
                              LOCAL StartRow,EndRow,Totrows,Totcols AS LONG, s AS STRING
                             
                              SendMessage(hGrid1,%MLG_GETROWCOLTOTEX,VARPTR(totrows),VARPTR(totcols))
                              StartRow=@MLGN.Param1    'start row
                              EndRow=@MLGN.Param2      'end row
                              IF StartRow < 1 THEN EXIT FUNCTION
                             
                            
                               DIALOG SET TEXT ghDlg, USING$("Start row #  End row #",StartRow,EndRow)
                              DIM sData(StartRow TO EndRow, 0 TO totCols) AS STRING  'including column 0
                              MLG_GetEx hGrid1,sdata()
                              LOCAL r,c AS LONG
                              FOR r = StartRow TO EndRow  'lbound(sdata(1) to ubound(sdata(1))
                                FOR c = 0 TO totcols      'lBOUND(sData(2)) to ubound(sdata(2))
                                  s+= sdata(r,c) + ","
                                NEXT
                                ASC(s,LEN(s)) =  13 '
                              NEXT
                              FUNCTION = s
                              ? s,,FUNCNAME$
                            END FUNCTION
                            Option 1. Parse each record based on JOIN$(return value, $CR)
                            Option 2. CONTROL SET TEXT at s+=s(data(r,c) 'each column
                            https://www.tesla.com/roadster

                            Comment


                            • #15
                              Hello Mike,

                              Code:
                              Option 1. Parse each record based on JOIN$(return value, $CR)
                              Option 2. CONTROL SET TEXT at s+=s(data(r,c) 'each column
                              Great!

                              I really would like to use MLG in my next project. Do you have any more MLG routines you would like to share?

                              Thank you.
                              Fredrick Ughimi
                              www.meganetsoft.com

                              Comment


                              • #16
                                Starting a MLG DDT Demo using PBFORMS

                                This creates a grid using the coordinates of a label named %GridLabel placed onto a form using PBFORMS.
                                I'll have to test how to put a custom control on a form using PBFORMS since I haven't done that in a long time to get rid of the label technique.

                                I haven't used MLGPRINT, but it does a preview after displaying the data in a message box.

                                More buttons will be added as time permits.
                                Hopefully somebody might add functions to this starting point.
                                Code:
                                #PBFORMS CREATED V2.01
                                #COMPILE EXE     'MLG_DDT.BAS
                                #DIM ALL         'requires MLG.DLL MLGPRINT.DLL
                                GLOBAL ghGrid AS DWORD
                                GLOBAL ghDlg  AS DWORD
                                %RowsWanted = 23
                                %ColsWanted  = 2
                                $ColumnDelimiter = ""
                                TYPE PrintArea
                                  nTop AS LONG
                                  nleft AS LONG
                                  nBottom AS LONG
                                  nRight AS LONG
                                END TYPE
                                 #PBFORMS BEGIN INCLUDES
                                %USEMACROS = 1
                                #INCLUDE ONCE "WIN32API.INC"
                                #PBFORMS END INCLUDES
                                #INCLUDE "mlg.inc"
                                '
                                #PBFORMS BEGIN CONSTANTS
                                %IDD_DIALOG1 =  101
                                %IDC_MLGGRID =  100
                                %BUTTON1_CREATEGRID     = 1001
                                %BUTTON2_PUT_EACH_CELL  = 1002
                                %BUTTON3     = 1003
                                %GridLabel   = 1010
                                #PBFORMS END CONSTANTS
                                 #PBFORMS DECLARATIONS
                                FUNCTION PBMAIN()
                                  ShowDIALOG1 %HWND_DESKTOP
                                END FUNCTION
                                 '------------------------------------------------------------------------------
                                CALLBACK FUNCTION ShowDIALOG1Proc()
                                   SELECT CASE AS LONG CB.MSG
                                    CASE %WM_INITDIALOG
                                      ' Initialization handler
                                      ghDlg = CB.HNDL
                                    CASE %WM_NCACTIVATE
                                      STATIC hWndSaveFocus AS DWORD
                                      IF ISFALSE CB.WPARAM THEN
                                        ' Save control focus
                                        hWndSaveFocus = GetFocus()
                                      ELSEIF hWndSaveFocus THEN
                                        ' Restore control focus
                                        SetFocus(hWndSaveFocus)
                                        hWndSaveFocus = 0
                                      END IF
                                     CASE %WM_COMMAND
                                      ' Process control notifications
                                      SELECT CASE AS LONG CB.CTL
                                        CASE %BUTTON1_CREATEGRID
                                          IF CB.CTLMSG = %BN_CLICKED OR CB.CTLMSG = 1 THEN
                                            CreateGrid %RowsWanted,%ColsWanted
                                          END IF
                                         CASE %BUTTON2_PUT_EACH_CELL
                                          IF CB.CTLMSG = %BN_CLICKED OR CB.CTLMSG = 1 THEN
                                            GridPutEachCell
                                          END IF
                                         CASE %BUTTON3
                                          IF CB.CTLMSG = %BN_CLICKED OR CB.CTLMSG = 1 THEN
                                            GridGetEachCell
                                          END IF
                                      END SELECT
                                  END SELECT
                                END FUNCTION
                                '------------------------------------------------------------------------------
                                FUNCTION ShowDIALOG1(BYVAL hParent AS DWORD) AS LONG
                                  LOCAL lRslt  AS LONG
                                 #PBFORMS BEGIN DIALOG %IDD_DIALOG1->->
                                  LOCAL hDlg   AS DWORD
                                  LOCAL hFont1 AS DWORD
                                   DIALOG NEW hParent, "MLG DDT DEMO", 395, 248, 543, 208, %WS_POPUP OR %WS_BORDER _
                                    OR %WS_DLGFRAME OR %WS_THICKFRAME OR %WS_CAPTION OR %WS_SYSMENU OR _
                                    %WS_MINIMIZEBOX OR %WS_MAXIMIZEBOX OR %WS_CLIPSIBLINGS OR %WS_VISIBLE OR _
                                    %DS_MODALFRAME OR %DS_3DLOOK OR %DS_NOFAILCREATE OR %DS_SETFONT, _
                                    %WS_EX_CONTROLPARENT OR %WS_EX_LEFT OR %WS_EX_LTRREADING OR _
                                    %WS_EX_RIGHTSCROLLBAR, TO hDlg
                                  CONTROL ADD BUTTON, hDlg, %BUTTON1_CREATEGRID,    "Create", 5, 5, 50, 15
                                  CONTROL ADD BUTTON, hDlg, %BUTTON2_PUT_EACH_CELL, "Put", 5, 20, 50, 15
                                  CONTROL ADD BUTTON, hDlg, %BUTTON3, "Get", 5, 35, 50, 15
                                  CONTROL ADD LABEL,  hDlg, %GridLabel, "Welcome, please click Create, Put, Get", 65, 10, _
                                    425, 175
                                  CONTROL SET COLOR   hDlg, %GridLabel, %YELLOW, %BLUE
                                   FONT NEW "MS Sans Serif", 14, 0, %ANSI_CHARSET TO hFont1
                                   CONTROL SET FONT hDlg, %GridLabel, hFont1
                                #PBFORMS END DIALOG
                                  DIALOG SHOW MODAL hDlg, CALL ShowDIALOG1Proc TO lRslt
                                #PBFORMS BEGIN CLEANUP %IDD_DIALOG1
                                  FONT END hFont1
                                #PBFORMS END CLEANUP
                                  FUNCTION = lRslt
                                END FUNCTION
                                '
                                SUB CreateGrid(RowsWanted AS LONG, ColsWanted AS LONG)
                                  LOCAL x AS LONG,y AS LONG,gridwidth,gridheight AS LONG
                                  LOCAL s AS STRING
                                  s = "r" +FORMAT$(RowsWanted) ' r = # of rows
                                  s+= "/c" + FORMAT$(ColsWanted)
                                  CONTROL GET LOC ghdlg,%GridLabel TO x,y
                                  CONTROL GET SIZE ghdlg,%GridLabel TO gridwidth,gridheight
                                  CONTROL SHOW STATE ghDlg, %GridLabel, %SW_HIDE 'hide the label showing where grid should be
                                   'CONTROL ADD "MYLITTLEGRID", hDlg, %IDC_MLGGRID, "r25,5/c8/a1/i1/t2/m1First,Second,-,Third", 4, 14, 250, 150, %MLG_STYLE OR %WS_TABSTOP
                                  CONTROL ADD "MYLITTLEGRID", ghDlg, %IDC_MLGGRID, s, x, y, gridwidth,gridheight, %MLG_STYLE
                                  CONTROL HANDLE ghDlg, %IDC_MLGGRID TO ghGrid
                                  '? USING$("ghdlg #  ghGrid # x #  y # gridwidth # gridheight #",ghDlg,ghGrid,x,y,gridwidth,gridheight)
                                  MLG_INIT
                                END SUB
                                '
                                SUB GridPutEachCell
                                  LOCAL x,y AS LONG
                                  FOR x   = 1 TO %RowsWanted
                                    FOR y = 1 TO %ColsWanted
                                      MLG_PUT ghGrid,x,y,USING$("(r#_,c#)",x,y),0
                                    NEXT
                                  NEXT
                                  MLG_PUT ghGrid,x,y,USING$("r#_,c#",x,y),1 'refresh
                                  'need to set focus to the grid?
                                END SUB
                                 SUB GridGetEachCell
                                  LOCAL ROW,COL AS LONG
                                  DIM sAll(1 TO %RowsWanted) AS STRING    'all data
                                  DIM sOneRow(1 TO %ColsWanted) AS STRING    '1 row
                                  FOR ROW   = 1 TO %RowsWanted
                                    FOR COL = 1 TO %ColsWanted
                                      sOneRow(COL) = MLG_GET(ghGrid,ROW,COL)
                                    NEXT
                                    sAll(ROW) = JOIN$(sOneRow(),$ColumnDelimiter)
                                  NEXT
                                  ? JOIN$(sAll(),$CR),,"All data"
                                   'select print area
                                  LOCAL p AS PrintArea
                                  p.nTop=0
                                  p.nLeft=0
                                  p.nBottom=450
                                  p.nRight=200
                                  SendMessage ghGrid, %MLG_SETPRINTAREA,VARPTR(p),0
                                  SendMessage  ghGrid, %MLG_PRINTPREVIEW, 0,0
                                END SUB
                                https://www.tesla.com/roadster

                                Comment


                                • #17
                                  Hello Mike,

                                  Thanks for sharing. Great technic.

                                  >>I'll have to test how to put a custom control on a form using PBFORMS since I haven't done that in a long time to get rid of the label technique.

                                  Using custom control on a PBForms is pretty straight forward (Third Party Designers Section of the H). I use custom control on a PwrDev Form.
                                  Fredrick Ughimi
                                  www.meganetsoft.com

                                  Comment


                                  • #18
                                    Hello,

                                    Its pretty straight forward saving records from MLG to SQLitening using MLG_Get:

                                    Code:
                                    sUsername = MLG_Get(hUsersGrid, 1, 1) 
                                    sPassword = MLG_Get(hUsersGrid, 1, 2)
                                    sStatus = MLG_Get(hUsersGrid, 1, 3) 
                                    
                                     slExe "Begin"
                                        Errorcode& = slExe(slBuildInsertOrUpdate("tblUsers", sUsername & $Nul & sPassword & $Nul & sStatus),"E")
                                     slExe "End"
                                       
                                    If Errorcode& = 19 Then
                                         MsgBox "Username Already Exists ", %MB_TASKMODAL Or %MB_ICONINFORMATION, VD_App.Title  
                                         Exit Function
                                    End If 
                                    
                                    ? "Record Saved!", %MB_TASKMODAL Or %MB_ICONINFORMATION, VD_App.Title
                                    Is there an example some where using MLG_GetEx to save multiple records at once?

                                    Best regards.
                                    Fredrick Ughimi
                                    www.meganetsoft.com

                                    Comment


                                    • #19
                                      This puts all data in an array to a grid and then converts the 2-dimensional array to a 1-dimensional array and saves to SQLitening.
                                      MLG_GETEX could be used the same way, but with the array dimensioned to hold only the rows of the grid that are wanted.
                                      If this isn't what you want then I'll come up with another demo.

                                      Note that the grid isn't even created to hold any number of rows or columns since Mlg_PutEx does it all!
                                      Mlg_PutEx ghGrid,gsRowsCols(),-4,1 '-4=do not write over row or column headers,1


                                      Code:
                                      #INCLUDE "win32api.inc"     'mlg uses arrays (rows,cols)
                                      #INCLUDE "mlg.inc"          'sqlitening uses (cols,rows)
                                      #INCLUDE "sqlitening.inc"
                                      %GRID = 101
                                      GLOBAL ghGrid AS DWORD, gsRowsCols() AS STRING
                                      
                                      FUNCTION PBMAIN () AS LONG
                                        LOCAL hDlg AS DWORD,r,c,cols,rows AS LONG
                                        rows = 30:cols = 5
                                        DIALOG NEW 0, "Values in grid",,, 520, 370, %WS_SYSMENU OR %WS_THICKFRAME TO hDlg
                                        CONTROL ADD "MYLITTLEGRID",hDlg,%GRID,"",0,0,520,370,%MLG_STYLE OR %WS_TABSTOP
                                        CONTROL HANDLE hDlg, %GRID TO ghGrid
                                        DIM gsRowsCols(1 TO rows,1 TO cols) 'mlg using (r,c) order
                                        FOR r = 1 TO rows
                                          FOR c = 1 TO cols
                                            gsRowsCols(r,c)=USING$("r# c#",r,c)
                                          NEXT
                                        NEXT
                                        Mlg_PutEx ghGrid,gsRowsCols(),-4,1  '-4=do not write over row or column headers,1=refresh grid
                                        DIALOG SHOW MODELESS hDlg
                                        SLEEP 1000
                                        
                                        slOpen "sample.db3","C"
                                        slexe  "drop table if exists mlg"
                                        slexe  "create table if not exists mlg(c1 primary key,c2,c3,c4,c5)"
                                        DIM s(1 TO UBOUND(gsRowsCols)) AS STRING '30 rows
                                        FOR r = 1 TO UBOUND(gsRowsCols)
                                          FOR c = 1 TO UBOUND(gsRowsCols,2)
                                            s(r)+= slBuildBindDat(gsRowsCols(r,c),"")
                                          NEXT
                                        NEXT
                                        LOCAL QuestionMarks AS STRING
                                        QuestionMarks = REPEAT$(cols-1,"?,")+"?"
                                        slexebind "insert into mlg values("+QuestionMarks + ")",JOIN$(s(),""),"V" + FORMAT$(cols)
                                        slSelAry "select * from mlg order by rowid",s(),"Q9"
                                        ? JOIN$(s(),$CR),,"Values in table"
                                      END FUNCTION
                                      Attached Files
                                      Last edited by Mike Doty; 13 Oct 2015, 09:58 PM.
                                      https://www.tesla.com/roadster

                                      Comment


                                      • #20
                                        SQLitening creates 2-dimensional arrays(col,row)
                                        MLG wants 2-dimensional arrays(row,col)
                                        This demo uses slSelAry, but creates an array to MLG's liking.
                                        Code:
                                        #INCLUDE "win32api.inc"     'mlg uses arrays (rows,cols)
                                        #INCLUDE "mlg.inc"          'sqlitening uses (cols,rows)
                                        #INCLUDE "sqlitening.inc"
                                        %GRID = 101
                                        %DropTable = 0
                                        '
                                        FUNCTION PBMAIN () AS LONG
                                          LOCAL hDlg,hGrid AS DWORD, rows AS LONG
                                          LOCAL RowsCols() AS STRING
                                          DIALOG NEW 0, "Values in grid",,, 520, 370, %WS_SYSMENU OR %WS_THICKFRAME TO hDlg
                                          CONTROL ADD "MYLITTLEGRID",hDlg,%GRID,"",0,0,520,370,%MLG_STYLE OR %WS_TABSTOP
                                          CONTROL HANDLE hDlg, %GRID TO hGrid
                                          WriteSampleDataToTable 200
                                          slGetRowColArray "select * from mlg",RowsCols()
                                          rows = UBOUND(RowsCols)
                                          Mlg_PutEx hGrid,RowsCols(),-4,1  '-4=do not write over row or column headers,1=refresh grid
                                          DIALOG SHOW MODAL hDlg
                                        END FUNCTION
                                        
                                        SUB slGetRowColArray(sql AS STRING,RowsCols() AS STRING)
                                         'Read data into ColRow() for SQLitening return RowCol() for MLG
                                          LOCAL r,c,rows,cols AS LONG, ColsRows() AS STRING
                                          slOpen "sample.db3","C"
                                          slSelAry sql,ColsRows()
                                          rows = UBOUND(ColsRows,2)
                                          cols = UBOUND(ColsRows,1)
                                          DIM RowsCols(1 TO rows,1 TO cols) AS STRING
                                          FOR r = 1 TO rows
                                            FOR c = 1 TO cols
                                              RowsCols(r,c) = ColsRows(c,r)
                                            NEXT
                                          NEXT
                                        END SUB
                                         
                                        SUB WriteSampleDataToTable(HowMany AS LONG)
                                          LOCAL x AS LONG
                                          slOpen "sample.db3","C"
                                          IF %DropTable THEN slexe "drop table if exists mlg"
                                          slexe "create table if not exists mlg(c1 integer primary key,c2,c3,c4,c5)"
                                          slexe "begin exclusive"  'can be made faster by combining
                                          FOR x = 1 TO HowMany
                                            slexe "insert into mlg values(null,'how','now','brown','cow')
                                          NEXT
                                          slexe "end"
                                          slclose
                                        END SUB
                                        https://www.tesla.com/roadster

                                        Comment

                                        Working...
                                        X