Skip to Content
0
Former Member
Oct 27, 2010 at 11:31 AM

multi selection in grid

20 Views

Hello freind

i have one form which have one GRID and MATRIX now i want when i selct entry from grid one by one it add in matrix sequntially.i create one code but it add only one entry in matrix and when i select other entry i get overlap on previous entry.so if yu have solution pls give me for sample code

this is my code

If (pVal.Before_Action = False) Then

If pVal.ItemUID = "1000002" Then

oForm = objMain.objApplication.Forms.Item(FormUID)

Dim Tid, Tname As String

Dim oedit As SAPbouiCOM.EditText

Dim i, j As Integer

objGrid = oForm.Items.Item("1000002").Specific

i = objGrid.Rows.SelectedRows.Item(0, SAPbouiCOM.BoOrderType.ot_SelectionOrder)

oMatrix = oForm.Items.Item("1000012").Specific

' oMatrix.Clear()

oMatrix.FlushToDataSource()

oDBs_Detail1 = oForm.DataSources.DBDataSources.Add("@UPDATE5")

Try

Dim y As String

For k As Integer = 1 To oMatrix.RowCount

Tid = objGrid.DataTable.GetValue("Test", i)

Tname = objGrid.DataTable.GetValue("Name", i)

'oMatrix.AddRow()

y = oMatrix.Columns.Item("V_1").Cells.Item(k).Specific.value

If y = "" Then

oMatrix.FlushToDataSource()

oDBs_Detail1.Offset = k - 1

oDBs_Detail1.SetValue("LineId", oDBs_Detail1.Offset, i)

oDBs_Detail1.SetValue("U_TId", oDBs_Detail1.Offset, Tid)

oDBs_Detail1.SetValue("U_TName", oDBs_Detail1.Offset, Tname)

oMatrix.SetLineData(k)

oMatrix.FlushToDataSource()

Exit For

Else

oMatrix = oForm.Items.Item("1000012").Specific

oDBDataSource = oForm.DataSources.DBDataSources.Item("@UPDATE5")

oMatrix.AddRow(1)

Dim otext2 As EditText

Dim rc8 As Integer = oMatrix.VisualRowCount

otext2 = oMatrix.Columns.Item("V_-1").Cells.Item(rc8).Specific

otext2.Value = rc8

End If

Next

Catch ex As Exception

objMain.objApplication.MessageBox(ex.Message)

End Try

End If

End If