Use of "row" in table_selectionchanged

Discussion in 'Questions (Windows Mobile)' started by BjornF, Jan 13, 2009.

  1. BjornF

    BjornF Active Member Licensed User

    Dear All,

    When I try to use the code below the first messagebox shows ok but then I get the error message in the attached file. If I choose to continue the next messagebox shows ok, and then another error message...

    (I first thought there was a problem with using "row" after a filtering, hence the use of Lrow)


    I don't understand why :sign0085:


    Code:
    Sub TblRas_SelectionChanged (ColName, Row)
       
    If ColName="RasNr" OR ColName="RasNamn" Then
          
    If tblRas.Cell("Chosen",Row)="X" Then
             tblRas.Cell(
    "Chosen",Row)=""
             LRow=Row
          
    Else
             tblRas.Cell(
    "Chosen",Row)="X"
             LRow=Row
          
    End If
       
    End If
       
    Msgbox("0:"&lrow)
       tblRas.SelectCell(
    "Dummy",Row)
    Msgbox("1:"&lrow)
       tblRas.Filter(
    "Chosen='X'")
       
    If tblRas.RowCount>0 Then LblInfo.Text="Ras: " & tblRas.Cell("RasNamn",0)
       tblRas.Filter(
    "")
    Msgbox("2:"&lrow)
       tblRas.SelectCell(
    "Dummy",LRow)
    End Sub
     
  2. klaus

    klaus Expert Licensed User

    Sorry, but there is no attached file ?

    Should there also be the code in the attached file ?

    Best regards.
     
  3. BjornF

    BjornF Active Member Licensed User

    :sign0013:

    forgot the file, thank you Klaus
     
  4. klaus

    klaus Expert Licensed User

    The problem is that in the SelectionChanged routine you Select a new cell, which generates a new SelectionChanged event and as the new column name doesn't match the if then test there is no value assigned to lrow !

    Try to put the last End If just before the End Sub statement to avoid selecting a new cell when the column doesn't match the test.

    But without the whole code and without knowing what you want to do it is difficult to give other advices.

    Best regards.
     
  5. BjornF

    BjornF Active Member Licensed User

    Aaargh, I don't know why I didn't catch it. It isn't the first time I have had problems with selection_changed. Many thanks Klaus, you have saved me :sign0188:

    Björn
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice