Techsolution2008
New member
- Joined
- May 29, 2012
- Messages
- 1
- Programming Experience
- 5-10
Hi All
I am facing an issue related to data refresh. I am working on a vb.Net project which reads information from a database table and prepares the UI based on the records it has. It uses table adapters. Following line is throwing number format exception when I reselect an value from a dropdown(say customer1, customer2 names are in combobox. On first time when i click combo and select customer1, it populates customer1 info in form. when i select customer2, again it presents information properly but when i select customer1 again, I get the following exception
AssessmentAndRETaxDataBindingSource.Position = _
Me.AssessmentAndRETaxDataBindingSource.Find("ReportID", Me.ReportIdTextBox.Text)
On debugging I found getting Me.ReportIdTextBox.Text as "" and which has no representation in Integer so Number format exception is coming but not getting any idea how is this value becoming null as same code is called. This holds proper value during first time selection of values customer1,2.
System.FormatException was unhandled by user code
Message="Input string was not in a correct format."
Source="mscorlib"
StackTrace:
at System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal)
at System.Number.ParseInt32(String s, NumberStyles style, NumberFormatInfo info)
at System.String.System.IConvertible.ToInt32(IFormatProvider provider)
at System.Data.Common.Int32Storage.ConvertValue(Object value)
at System.Data.Index.FindNodeByKey(Object originalKey)
at System.Data.DataView.System.ComponentModel.IBindingList.Find(PropertyDescriptor property, Object key)
at System.Windows.Forms.BindingSource.Find(PropertyDescriptor prop, Object key)
at System.Windows.Forms.BindingSource.Find(String propertyName, Object key)
at SimplicityReports.frmData.RefreshDatasets() in E:\Data\Odesk\McKnight\SimplicityReports_x32\SimplicityReports_x32\SimplicityReports_2007\SimplicityReportsSource\SimplicityReports\Forms\frmData.vb:line 1228
at SimplicityReports.frmData.FileNumberComboBox_SelectedIndexChanged(Object sender, EventArgs e) in E:\Data\Odesk\McKnight\SimplicityReports_x32\SimplicityReports_x32\SimplicityReports_2007\SimplicityReportsSource\SimplicityReports\Forms\frmData.vb:line 104
at System.Windows.Forms.ComboBox.OnSelectedIndexChanged(EventArgs e)
at System.Windows.Forms.ComboBox.WmReflectCommand(Message& m)
at System.Windows.Forms.ComboBox.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
InnerException:
Any pointers on this will be very helpful.
I am facing an issue related to data refresh. I am working on a vb.Net project which reads information from a database table and prepares the UI based on the records it has. It uses table adapters. Following line is throwing number format exception when I reselect an value from a dropdown(say customer1, customer2 names are in combobox. On first time when i click combo and select customer1, it populates customer1 info in form. when i select customer2, again it presents information properly but when i select customer1 again, I get the following exception
AssessmentAndRETaxDataBindingSource.Position = _
Me.AssessmentAndRETaxDataBindingSource.Find("ReportID", Me.ReportIdTextBox.Text)
On debugging I found getting Me.ReportIdTextBox.Text as "" and which has no representation in Integer so Number format exception is coming but not getting any idea how is this value becoming null as same code is called. This holds proper value during first time selection of values customer1,2.
System.FormatException was unhandled by user code
Message="Input string was not in a correct format."
Source="mscorlib"
StackTrace:
at System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal)
at System.Number.ParseInt32(String s, NumberStyles style, NumberFormatInfo info)
at System.String.System.IConvertible.ToInt32(IFormatProvider provider)
at System.Data.Common.Int32Storage.ConvertValue(Object value)
at System.Data.Index.FindNodeByKey(Object originalKey)
at System.Data.DataView.System.ComponentModel.IBindingList.Find(PropertyDescriptor property, Object key)
at System.Windows.Forms.BindingSource.Find(PropertyDescriptor prop, Object key)
at System.Windows.Forms.BindingSource.Find(String propertyName, Object key)
at SimplicityReports.frmData.RefreshDatasets() in E:\Data\Odesk\McKnight\SimplicityReports_x32\SimplicityReports_x32\SimplicityReports_2007\SimplicityReportsSource\SimplicityReports\Forms\frmData.vb:line 1228
at SimplicityReports.frmData.FileNumberComboBox_SelectedIndexChanged(Object sender, EventArgs e) in E:\Data\Odesk\McKnight\SimplicityReports_x32\SimplicityReports_x32\SimplicityReports_2007\SimplicityReportsSource\SimplicityReports\Forms\frmData.vb:line 104
at System.Windows.Forms.ComboBox.OnSelectedIndexChanged(EventArgs e)
at System.Windows.Forms.ComboBox.WmReflectCommand(Message& m)
at System.Windows.Forms.ComboBox.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
InnerException:
Any pointers on this will be very helpful.
