No announcement yet.

Milti DIM arrays??

  • Filter
  • Time
  • Show
Clear All
new posts

  • #41
    I hate happy endings....
    Note this can also be used to sort numeric values via the PB Using$ function in the Sort_Field.
    Not if the numeric value is less than zero it can't!

    But..... a little bell is ringing.......

    A long time ago, far far away I wrote something for PB/DOS which DOES sort UDTs by member, even if those members are numeric, eg "AS INTEGER" ("AS INTEGER" was BIG in PB/DOS).

    Not that it would all that tough to adapt my six-year old demo to handle that.

    You'd have to add a parameter to tell the function "sort as <some datatype>" but after that it's more tedious than challenging.

    Michael Mattias
    Tal Systems (retired)
    Port Washington WI USA
    [email protected]


    • #42
      "ridiculously easy" for MCM and other pro programmers but not for me and many others here just learning the basics.

      I have been fiddling with basic since the Atari basic and IBM xt basic came out and I am still just a novice at programming. The programs I make use the basics of basic code in PB, just enough to enter and process data and get data out the way I want. I have just made a small scratch in PB functions.

      Help was not to good compared to PB forms. I just relyed on two books: Quickbasic Advanced Techniques and The Power of Turbo Basic. And only study what was the most interest to me not from cover to cover.

      Basic progarmming help me solve the problem of good but bad software out there. Bought several finance software over many years only to be disappointed with bugs, bugs, and gone out of business. Then I did my own finance program and put an end to that. Also did not like their program interface to user.

      I only spent around 40 to 50 hour a week programming. I also have done some web programming and in the past spend a good amount of time with Alpha 4 database programming (decided basic prog. was better).

      I have learned what I wanted on arrays but will shelf the array sorting for now, have other programing to complete first. I do have my own sort routine not using arrays that sort by columns by the first and next column etc.

      Attached is the test program which I had modified but still have a minor bug for viewers who wish to check it out.
      Attached Files


      • #43

        I took the liberty of pointing our a couple places where Loops are probably more appropriate to use, less prone to typos and easier to debug.

          'try this instead
           Local ctr&
           For ctr = 1 To 5
             RC(I, ctr) = ""
           Next ctr        
         Return 'no need to go further
        If I=1 Then RC(1,1)="": RC(1,2)="":RC(1,3)="": RC(1,4)="":RC(1,5)="": RC(1,6)="":RC(1,7)=""
        IF I=2 THEN RC(2,1)="": RC(2,2)="":RC(2,3)="": RC(2,4)="":RC(2,5)="": RC(2,6)="":RC(2,7)=""
        IF I=3 THEN RC(3,1)="": RC(3,2)="":RC(3,3)="": RC(3,4)="":RC(3,5)="": RC(3,6)="":RC(3,7)=""
        IF I=4 THEN RC(4,1)="": RC(4,2)="":RC(4,3)="": RC(4,4)="":RC(4,5)="": RC(4,6)="":RC(4,7)=""
        IF I=5 THEN RC(5,1)="": RC(5,2)="":RC(5,3)="": RC(5,4)="":RC(5,5)="": RC(5,6)="":RC(5,7)=""
          'try this instead   'simpler to read and debug
          If TestNR > 0 Then
          End If
         Return 'no need to go further
        IF I=1 AND TestNR>0 THEN RC(1,1)=T1: RC(1,2)=T2: RC(1,3)=T3: RC(1,4)=T4: RC(1,5)=T5: RC(1,6)=T6: RC(1,7)=T7
        IF I=2 AND TestNR>0 THEN RC(2,1)=T1: RC(2,2)=T2: RC(2,3)=T3: RC(2,4)=T4: RC(2,5)=T5: RC(2,6)=T6: RC(2,7)=T7
        IF I=3 AND TestNR>0 THEN RC(3,1)=T1: RC(3,2)=T2: RC(3,3)=T3: RC(3,4)=T4: RC(3,5)=T5: RC(3,6)=T6: RC(3,7)=T7
        IF I=4 AND TestNR>0 THEN RC(4,1)=T1: RC(4,2)=T2: RC(4,3)=T3: RC(4,4)=T4: RC(4,5)=T5: RC(4,6)=T6: RC(4,7)=T7
        IF I=5 AND TestNR>0 THEN RC(5,1)=T1: RC(5,2)=T2: RC(5,3)=T3: RC(5,4)=T4: RC(5,5)=T5: RC(5,6)=T6: RC(5,7)=T7
        END SUB
        Sub DSPRST_Test_AddEdit
        LOCAL Row&, Column&
          Row = 5: Column = 10
          DIM Lbl(Row, Column), RC(1:20, 1:20) AS STRING
        CALL DSP_Test_AddEdit
        'Ccode below could be more easily done this way:
          For Row = 1 To 5
             For Column = 1 To 7
                 Control Set Text hDlg, LBL(Row, Column), RC(Row, Column)
             Next Column
          Next Row
         Exit Sub 'Exit here, no need of rest of Sub
        CONTROL SET TEXT hDlg, LBL(1,1), RC(1,1)
        CONTROL SET TEXT hDlg, LBL(1,2), RC(1,2)
        CONTROL SET TEXT hDlg, LBL(1,3), RC(1,3)
        CONTROL SET TEXT hDlg, LBL(1,4), RC(1,4)
        CONTROL SET TEXT hDlg, LBL(1,5), RC(1,5)
        CONTROL SET TEXT hDlg, LBL(1,6), RC(1,6)
        CONTROL SET TEXT hDlg, LBL(1,7), RC(1,7)
        CONTROL SET TEXT hDlg, LBL(2,1), RC(2,1)
        CONTROL SET TEXT hDlg, LBL(2,2), RC(2,2)
        CONTROL SET TEXT hDlg, LBL(2,3), RC(2,3)
        CONTROL SET TEXT hDlg, LBL(2,4), RC(2,4)
        CONTROL SET TEXT hDlg, LBL(2,5), RC(2,5)
        CONTROL SET TEXT hDlg, LBL(2,6), RC(2,6)
        CONTROL SET TEXT hDlg, LBL(2,7), RC(2,7)
        CONTROL SET TEXT hDlg, LBL(3,1), RC(3,1)
        ... 'Lots of lines in here
        CONTROL SET TEXT hDlg, LBL(5,7), RC(5,7)
        END SUB
        "Too many pieces of music finish
        too long after the end."
        Igor Stravinsky (1882-1971)
        Last edited by Gösta H. Lovgren-2; 2 Aug 2008, 01:31 PM. Reason: Erudition (hopefully)
        It's a pretty day. I hope you enjoy it.


        JWAM: (Quit Smoking):
        LDN - A Miracle Drug: