on 09-05-2008 11:27 AM
Hi All,
I tried following code on LostFocus event of Mtrix. I want to do addition of two columns cells of matrix and addtion display in third column. I tried the following code but in this I am getting the column value and when i enterd any value in columns cells it disappear when i move to next column cells.
Can anybody suggest me how to do it ?
Dim i As Integer
Dim v1, v2 As String
matrix.Columns.Item("V_4").DataBind.SetBound(True, "", "matrixds")
If pVal.ColUID = "V_4" Then
For i = 0 To matrix.RowCount - 1
v1 = matrix.Columns.Item("V_5").Cells.Item(i + 1).Specific.Value
v2 = matrix.Columns.Item("V_4").Cells.Item(i + 1).Specific.Value
Dim v3 As Integer = CInt(v1) + CInt(v2)
matrix.Columns.Item("V_3").Cells.Item(i + 1).Specific.Value = v3.ToString()
Next
End If
Thanks and Regards,
Harish,
Try this, in the below code i'm doing a similar operation, just change the operation...
Dim objEdit, objEdit2 As SAPbouiCOM.EditText
objEdit = objMatrix.Columns.Item("V_14").Cells.Item(pVal.Row).Specific
dblQty = objEdit.String
objEdit = objMatrix.Columns.Item("V_13").Cells.Item(pVal.Row).Specific
dblUnitPrice = objEdit.String
objEdit = objMatrix.Columns.Item("V_10").Cells.Item(pVal.Row).Specific
dblRowTot = dblQty * dblUnitPrice
objEdit.String = dblRowTot
the above code is executed in LOST FOCUS in the BeforeAction = False condition.
Hope it helps,
Vasu Natari.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi..
ur using userdefined form and ur total column is non-editable
use this code..
Dim i As Integer
Dim v1, v2 As String
matrix.Columns.Item("V_4").DataBind.SetBound(True, "", "matrixds")
If pVal.ColUID = "V_4" Then
For i = 0 To matrix.RowCount - 1
v1 = matrix.Columns.Item("V_5").Cells.Item(i + 1).Specific.Value
v2 = matrix.Columns.Item("V_4").Cells.Item(i + 1).Specific.Value
Dim v3 As Integer = CInt(v1) + CInt(v2)
matrix.Columns.Item("V_3").Cells.Item(i + 1).Specific.Value = v3.ToString()
Next
End If
oForm.Update()
Regards...
Billa 2007
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
u bind all the columns to the datasource in the matrix.then the value does not disappear.
Change ur code as follows:
Use the databind in formload
matrix.Columns.Item("V_4").DataBind.SetBound(True, "", "matrixds1")
matrix.Columns.Item("V_5").DataBind.SetBound(True, "", "matrixds2")
matrix.Columns.Item("V_3").DataBind.SetBound(True, "", "matrixds3")
-
Dim v1, v2 As sapbouicom.edittext
If pVal.ColUID = "V_4" Then
v1 = matrix.Columns.Item("V_5").Cells.Item(pVal.row).Specific
v2 = matrix.Columns.Item("V_4").Cells.Item(pVal.row).Specific
v3= matrix.Columns.Item("V_3").Cells.Item(pVal.row).Specific
v3.Value = v1 .Value + v2.Value
End If
Kind Regards
Mohana
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
108 | |
12 | |
11 | |
6 | |
5 | |
4 | |
3 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.