Table Trouble

Discussion in 'Questions (Windows Mobile)' started by RandomCoder, Jul 14, 2007.

  1. RandomCoder

    RandomCoder Well-Known Member Licensed User

    I'm currently working on trying to improve my editable table to make it easier for others to integrate into their own code and also to add a couple of new features.

    I'm doing this by adding the Table Column Info into a structured array for use later in the program.
    This all worked fine until I decided to also include the Column type.

    Below is my code....
    Code:
    Sub Globals
     
    Dim Type(ColType,Description,ColWidth) ColumnNumber(3)
     SelectedCol=
    "" :SelectedRow=""
    End Sub

    Sub App_Start
     InitialiseTable
     Form1.Show
     TextBox1.Focus
    End Sub

    Sub InitialiseTable
     ColumnNumber(
    0).ColType="cString"
     ColumnNumber(
    0).Description="ID"
     ColumnNumber(
    0).ColWidth=30
     ColumnNumber(
    1).ColType="cString"
     ColumnNumber(
    1).Description="Description"
     ColumnNumber(
    1).ColWidth=120
     ColumnNumber(
    2).ColType="cString"
     ColumnNumber(
    2).Description="Date"
     ColumnNumber(
    2).ColWidth=60

     
    For Index=0 To ArrayLen(ColumnNumber())-1
    [COLOR=
    "Red"] Table1.AddCol(cString,ColumnNumber(Index).Description,ColumnNumber(Index).ColWidth,False)[/COLOR]
    [COLOR=
    "SeaGreen"'Table1.AddCol(ColumnNumber(Index).ColType,ColumnNumber(Index).Description,ColumnNumber(Index).ColWidth,False)[/COLOR]
     Next

     
    For ID = 0 To 5
     Table1.AddRow(
    ID,"","")
     
    Next
    End Sub
    The red highlighted line works fine, but when I swap this with the commented line below I get a FormatException Error.
    But as you can see I am setting the ColType variable to cString and so their should be no difference.
    Any idea's as to why it won't allow me to do this :confused:

    Regards,
    RandomCoder
     
  2. dzt

    dzt Active Member Licensed User

    Obviously this is an after hours work :).
    Change code above with ColumnNumber(0).ColType=cString
     
  3. RandomCoder

    RandomCoder Well-Known Member Licensed User

    Dzt, thank you.

    It was getting late and I guess I just couldn't see the wood for the trees.

    Regards,
    RandomCoder
     
Loading...