Skip to Content
author's profile photo Former Member
Former Member

Get selected row

Hi,

I want to get a selected row from matrix and I'm using the code:

For i=1 To oMatrix..RowCount

if oMatrix.IsRowSelected(i) then

msgbox "I want to delete this row"

endif

Next i

When I run my application I can't get the message "I want to delete this row".

Matrix properties:

Enabled = True

SelectionMode = ms_Auto (I've tried all the values)

What's wrong?

Fernando.

Add a comment
10|10000 characters needed characters exceeded

Related questions

4 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Jan 05, 2005 at 11:09 AM

    What's the double point after oMatrix?

    Regards

    Mark

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 05, 2005 at 11:22 AM

    Hi Mark,

    the double point was my mistake. The code has only one point.

    Regards.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 05, 2005 at 02:44 PM

    Ajith,

    I've tried and I've got the selected row. In fact my code can also get the row. My problem is that I have my cursor positioned in one cell and BO doesn't recognize it as selection. I have to select the all row.

    Thanks.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 05, 2005 at 02:46 PM

    This code is not working because you are comparing the result of the 'IsRowSelected' method with a VB 'True' value.

    Although logically what you are doing is correct, it won't work here even though the return value of the 'IsRowSelected' method is typed as boolean.

    This is a bug in SAP.

    Instead of comparing with 'True' or 'False', you need to use the SAPbobsCOM.BoYesNoEnum enumeration instead. This just means use 'tYes' instead of 'True', and 'tNo' instead of 'False'

    Here's a function that I use to find the first selected row in a matrix. It uses the method I've just described.

    Public Function GetFirstSelectedRowInMatrix(ByVal Matrix As SAPbouiCOM.Matrix)

    Dim Index As Long

    Dim ReturnValue As Long

    '

    ' Default to -1

    '

    ReturnValue = -1

    If Not Matrix Is Nothing Then

    For Index = 1 To Matrix.RowCount

    If Matrix.IsRowSelected(Index) = tYES Then

    ReturnValue = Index

    Exit For

    End If

    Next Index

    End If

    GetFirstSelectedRowInMatrix = ReturnValue

    End Function

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.