HKH1967
asked on
VB.NET CALCULATION null
I HAVE THIS SQL IN VB.NET THAT CONTAIN SOME TIMES NULL VALUE
While running the vb.net it give error because of null value
Dim TotalDeducttion As Decimal = (txtAgentCommission.Text) + CDec(txtAmendCharges.Text) + CDec(txtTelexCharges.Text) + CDec(txtCollectionCharges. Text) + CDec(txtSwiftCharges.Text) + CDec(txtAntOtherCharges.Te xt)
how to fix it in vb.net
While running the vb.net it give error because of null value
Dim TotalDeducttion As Decimal = (txtAgentCommission.Text) + CDec(txtAmendCharges.Text)
how to fix it in vb.net
Add an
End If
after line 9.
End If
after line 9.
ASKER
Genius
I try it and i got the the following error
Conversion from string "" to type 'Decimal' is not valid.
the code
Dim DocAmount As Decimal = CDec(txtDocAmount.Text) - CDec(CDec(txtAgentCommissi on.Text) + CDec(txtAmendCharges.Text) + CDec(txtTelexCharges.Text) + CDec(txtCollectionCharges. Text) + CDec(txtSwiftCharges.Text) + CDec(txtAntOtherCharges.Te xt))
was in the green color
I try it and i got the the following error
Conversion from string "" to type 'Decimal' is not valid.
the code
Dim DocAmount As Decimal = CDec(txtDocAmount.Text) - CDec(CDec(txtAgentCommissi
was in the green color
ASKER
Genius
CodeCruiser:
Add an
End If
after line 9.
i have the end if and the result as above
CodeCruiser:
Add an
End If
after line 9.
i have the end if and the result as above
ASKER
Genius
sorry the error as follows:
Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.
Compiler Error Message: BC30288: Local variable 'TotalDeducttion' is already declared in the current block.
Source Error:
Line 176:
Line 177: Dim TotalDeducttion As Decimal = GetText(txtAgentCommission ) + GetText(txtAmendCharges) + GetText(txtTelexCharges) + GetText(txtCollectionCharg es) + GetText(txtSwiftCharges) + GetText(txtAntOtherCharges )
Line 178: Dim TotalDeducttion As Decimal
Line 179: lblTotalDeduction.Text = TotalDeducttion
Line 180: lblNetproceeds.Text = DocAmount
Source File: E:\Projects\NcbWork\Defaul t.aspx.vb Line: 178
sorry the error as follows:
Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.
Compiler Error Message: BC30288: Local variable 'TotalDeducttion' is already declared in the current block.
Source Error:
Line 176:
Line 177: Dim TotalDeducttion As Decimal = GetText(txtAgentCommission
Line 178: Dim TotalDeducttion As Decimal
Line 179: lblTotalDeduction.Text = TotalDeducttion
Line 180: lblNetproceeds.Text = DocAmount
Source File: E:\Projects\NcbWork\Defaul
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
thanks alot
Glad to help :-)
Open in new window