Skip to Content
avatar image
Former Member

Disabling the text box fields

In sap b1 visual studio add on the value of first two column should multiply and third column should be added and fourth column should be subtracted mean while the total(Last)column should get disabled with the value getting from the other column . Any one could help using visual studio coding??

image.png (43.8 kB)
Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

4 Answers

  • Nov 29, 2016 at 06:44 AM

    Attach an event listener for the After Validate of the 4 columns
    Calculate however you want inside this event handler.
    Set the Value using the DBDataSource.SetValue("Column",Row,Value);

    You can disable the column from B1Studio or via coding oMatrix.Columns.Item("LastColUID").Editable = false;


    Regards
    Edy

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Nov 29, 2016 at 08:31 AM

    Hi Edy Simon

    This is my coding , And what i have to add to calculate and bring the sum of value while the answer displayed in the last column should not be editable

    If pval.ItemUID = "Item_24" And (pval.ColUID = "Col_5" Or pval.ColUID = "Col_1" Or pval.ColUID = "Col_2" Or pval.ColUID = "Col_3") Then Dim mat As SAPbouiCOM.Matrix mat = OForm.Items.Item("Item_24").Specific

    Dim Seats As Double = mat.Columns.Item("Col_5").Cells.Item(pval.Row).Specific.value

    Dim Price As Double = mat.Columns.Item("Col_1").Cells.Item(pval.Row).Specific.value

    Dim vat As Double = mat.Columns.Item("Col_2").Cells.Item(pval.Row).Specific.Value

    Dim Discount As Double = mat.Columns.Item("Col_3").Cells.Item(pval.Row).Specific.value

    mat.Columns.Item("Col_4").Cells.Item(pval.Row).Specific.value = Seats * Price + vat - Discount

    End If

    Add comment
    10|10000 characters needed characters exceeded

  • Nov 29, 2016 at 09:11 AM

    When you draw this form, set :

    mat.Columns.Item("Col_4").Editable = false

    And instead of setting

    mat.Columns.Item("Col_4").Cells.Item(pval.Row).Specific.value = Seats * Price + vat - Discount

    Set the DataSource that this matrix column is bound to
    ie. if the column is bound to a UserDataSource, use

    mat.GetLineData
    Form.DataSources.UserDataSource.Item("udsUID").Value = Seats * Price + vat - Discount
    mat.SetLineData

    if the column is bound to a DataTable, use

    mat.FlushToDataSource<br>Form.DataSources.DataTable.Item("dtUID").SetValue("colUID",pVal.Row-1, Seats * Price + vat - Discount)mat.LoadFromDataSource

    Regards

    Edy

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Nov 29, 2016 at 12:56 PM

    Thank you Edy Simon

    Add comment
    10|10000 characters needed characters exceeded