Dim intBudget As Integer 尝试 intBudget = CType(CType(gvr.FindControl(" txtBudget")), TextBox).Text.Trim(),Int32) Catch intBudget = CType(0,Int32)结束尝试 '// --Checkboxes Dim intCurrentMonthCollections As Boolean = CType(gvr.FindControl(" chbx_CurrentMonthCollection s"),CheckBox).Checked Dim intRevenueByMonth As Boolean = CType(gvr。 FindControl(" chbx_RevenueByMonth"),CheckBox).Checked Dim intPDCsCCsMonthly As Boolean = CType(gvr.FindControl(" chbx_PDCsCCsMonthly"),CheckBox).Checked Dim intRevenueByClient As Boolean = CType(gvr.FindControl(" chbx_RevenueByClient"),CheckBox).Checked ''// - 分配UpdateParameters 如果intCurrentMonthCollections = True那么 ds_dashboard.UpdateParameters(" CurrentMonthCollect ions")。DefaultValue = 1 否则 ds_dashboard.UpdateParameters(" CurrentMonthCollect ions")。DefaultValue = 0 结束如果 ds_dashboard.UpdateParameters("预算")。DefaultVal ue = intBudget ds_dashboard.Update()结束如果下一页结束子 - dba123 Why am I getting this error for Budget? Error: An exception of type ''System.FormatException'' occurred in mscorlib.dll but was not handled in user code Additional information: String was not recognized as a valid Boolean. Public Sub UpdateCustomer_DashboardGraphs(ByVal sender As Object, ByVal e As System.EventArgs) For Each gvr As GridViewRow In gv_dashboard.Rows If gvr.RowType = DataControlRowType.DataRow Then ''//--IDs Dim intCustomerID As String = CType(gvr.FindControl("lblCustomerID"), Label).Text.Trim() ''//--Textboxes Dim intBudget As Integer Try intBudget = CType(CType(gvr.FindControl("txtBudget"), TextBox).Text.Trim(), Int32) Catch intBudget = CType(0, Int32) End Try ''//--Checkboxes Dim intCurrentMonthCollections As Boolean = CType(gvr.FindControl("chbx_CurrentMonthCollection s"), CheckBox).Checked Dim intRevenueByMonth As Boolean = CType(gvr.FindControl("chbx_RevenueByMonth"), CheckBox).Checked Dim intPDCsCCsMonthly As Boolean = CType(gvr.FindControl("chbx_PDCsCCsMonthly"), CheckBox).Checked Dim intRevenueByClient As Boolean = CType(gvr.FindControl("chbx_RevenueByClient"), CheckBox).Checked ''//--Assign UpdateParameters If intCurrentMonthCollections = True Then ds_dashboard.UpdateParameters("CurrentMonthCollect ions").DefaultValue = 1 Else ds_dashboard.UpdateParameters("CurrentMonthCollect ions").DefaultValue = 0 End If ... ds_dashboard.UpdateParameters("Budget").DefaultVal ue = intBudget ds_dashboard.Update() End If Next End Sub -- dba123 这篇关于字符串未被识别为有效的布尔值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云! 08-06 18:26