Skip to Content
0
Former Member
May 26, 2009 at 08:21 AM

Select a Row in a gird via Code

96 Views

Hello again, pherhaps someone has an idea how i can get a solution for me issue 😊

<b>Following is happen:</b>

- I have an Textbox where a User can type in an Extendsearch for the shown Grid

- with the Text in the Textbox I go throw the Gird

- Have I found a match in the gird of the Text the User has searched I would to show the result on the Grid with highlighting the Row of the First match

<b>Today I have the logic to get throw the row to find a match:</b>

' Search for the Place of typed Key

Dim sKey As String = SBOapplication.Forms.Item(pVal.FormUID).Items.Item("txtOrtFind").Specific.Value

oSAPCI.GetItemInfo(SBOapplication.Forms.Item(pVal.FormUID))

Dim oGrid As SAPbouiCOM.Grid = SBOapplication.Forms.Item(pVal.FormUID).Items.Item("gridView").Specific

Dim sComp As String = ""

' Search throw the grid

For i As Integer = 1 To oGrid.Rows.Count

Try

' Get the Value of each Row

sComp = oGrid.DataTable.GetValue("ORT", oGrid.GetDataTableRowIndex(i))

If sComp.Substring(0, sKey.Length).ToLower = sKey.ToLower Then

' So I have found the match

' Now I would show the result on the grid

' The Row Index of the Gird is "i"

' Now there Comes the Problem, How could I select this specific Row "i" in the Grid?

End If

Catch ex As Exception

End Try

Next

Thx for your regards

Edited by: Gerald Schwarz on May 26, 2009 10:25 AM