Summing multiple columns in a table

  • Thread starter Thread starter OgiKore
  • Start date Start date
O

OgiKore

Guest
The specific part of my code below is showing a 'Operand of a type object used for operator '+' ; runtime errors could occur

Dim index As Integer = 0
For Each row As DataRow In ExpensesDataSet.Weekly_Expense_Table.Rows
row("PAGE_TOTAL") = row("ACCOUNTANT_FEES") + row("BROKERAGE_FEE") + row("BUSINESS_INCOME_TAX") + row("CDL_RENEWALS") _
+ row("CLOTHING_EXPENSE") + row("COST_OF_ITEM") + row("DOT_PHYSICAL") + row("DRUG_CONSORTIUM") + row("EQUIPMENT_WASHING") _
+ row("EZPASS_FEE") + row("FED_EMP_INCOME_TAX") + row("FED_HEAVY_USE") + row("FED_PAYROLL_TAX") + row("FUEL_CARD_CHARGE") _
+ row("IFTA_FEES") + row("KY_ROAD_USE") + row("MEDICARE_TAX") + row("NM_ROAD_USE") + row("NY_ROAD_USE") + row("PAYROLL_FEES") _
+ row("PAYROLL_SOFTWARE") + row("PAYROLL_TOTAL") + row("PB_ADJUSTMENT") + row("PERMIT_PURCHASE") + row("PIKE_PASS_FEE") _
+ row("PRE_PASS_FEE") + row("PU_DRP_TRLR_FEE") + row("PURCHASE_TAX_PAID") + row("QC_RENTAL") + row("RAND_MCNALLY") _
+ row("SOCIAL_SECURITY_TAX") + row("STATE_PAYROLL_TAX") + row("SUN_PASS_FEE") + row("TAX_AMOUNT_PAID") + row("TN_ANNUAL_REPORT") _
+ row("TN_FRANCHISE_TAX") + row("TN_INCOME_TAX") + row("TRANSACTION_FEE") + row("TRAILER_INSPECTION") + row("TRAILER_OTHER") _
+ row("TRAILER_PAYMENT") + row("TRANSFLO_FEE") + row("TRAVEL_EXPENSE") + row("TRUCK_INSPECTION") + row("TRUCK_INSURANCE") _
+ row("TRUCK_PAYMENTS") + row("TRUCK_REGISTRATION") + row("TRUCK_WASHING") + row("UCR_YEARLY")
Next




Is there a better way to do this?

Continue reading...
 
Back
Top