Hi,
I am working with a simple grid and use VB.NET.
I have 2 UDF in my grid: U_HOV and U_HandOver
I have made the column U_HandOver a column of checkboxes, and U_HOV a column of EditText
What I want to do?
When I click any checkbox, I want say "1" to appear on the same row in column U_HOV.
Runtime
When I click on any checkbox, "1" does not appear in the U_HOV column.
Here is my code, which I put in the following section:
Private Sub SBO_Application_ItemEvent(ByVal FormUID As String, ByRef pVal As SAPbouiCOM.ItemEvent, ByRef BubbleEvent As Boolean) Handles SBO_Application.ItemEvent
------
If FormUID = "frmGrid" And pVal.BeforeAction = False _
And pVal.EventType = SAPbouiCOM.BoEventTypes.et_CLICK _
And pVal.ItemUID = "MyGrid" _
And pVal.ColUID = "U_HandOver" Then
Dim oGridRow As Integer = pVal.Row
If oGrid.DataTable.GetValue("U_HandOver", oGrid.GetDataTableRowIndex(pVal.Row)).ToString() = "Y" Then
oGrid.DataTable.SetValue("U_HOV", oGridRow, 1)
------
Could anyone help me find where is my error?
Thanks
Leon Lai
Hi Leon,
you also have to set the value to the datatable :
If oGrid.DataTable.GetValue("U_HandOver", oGrid.GetDataTableRowIndex(pVal.Row)).ToString() = "Y" Then oGrid.DataTable.SetValue("U_HOV", oGrid.GetDataTableRowIndex(pVal.Row), 1)
-> you need the datatable row from the clicked grid row : oGrid.GetDataTableRowIndex()
There is also an other way to set the value :
((SAPbouiCOM.EditTextColumn)oGrid.Columns.Item("U_HOV")).SetText(pVal.Row, "1")
Which would set the Text in the Cell of the Grid.
regards,
Maik
Hi,
Try to write same code on lost focus event of ColUID.
If FormUID = "frmGrid" And pVal.BeforeAction = False _
And pVal.EventType = SAPbouiCOM.BoEventTypes.et_LOSTFOUCS _
And pVal.ItemUID = "MyGrid" _
And pVal.ColUID = "U_HandOver" Then
Dim oGridRow As Integer = pVal.Row
If oGrid.DataTable.GetValue("U_HandOver", oGrid.GetDataTableRowIndex(pVal.Row)).ToString() = "Y" Then
oGrid.DataTable.SetValue("U_HOV", oGridRow, 1)
endif
regards,
Prasad
Hi Leon,
I think you have to set the value in the data table row also:
Dim oGridRow As Integer = pVal.Row
Dim dataTableRow As Integer = oGrid.GetDataTableRowIndex(pVal.Row)
If oGrid.DataTable.GetValue("U_HandOver", dataTableRow).ToString() = "Y" Then
oGrid.DataTable.SetValue("U_HOV", dataTableRow, 1)
,
ps: haven't tested the code above, you might need to do some adjustment.
Best regards,
Pedro Magueija
Add a comment