When I try to search for a component then I get the below error.
I don't want to make it compulsory for a user to select a date.
System.InvalidCastException: 'Conversion from string "" to type 'Date' is not valid.'
I have these two text boxes that saves the date from a datepicker control:
Dim OutOfSpec = chkOutOfSpec.Checked = True
Dim blnShowInKg As Boolean
Dim strStockCode As String = Microsoft.VisualBasic.Left(txtComponents.Text, InStr(1, txtComponents.Text, " : "))
Dim dtFromDate As DateTime = CDate(txtFrom.Text).ToString("yyyy/MM/dd")
Dim dtToDate As DateTime = CDate(txtTo.Text).ToString("yyyy/MM/dd")
mCWC = New aplComponentWeightChecks(My.Settings.Quality) Dim dtGetLast10Average As DataTable = mCWC.GetLast10AverageComponents(strStockCode, dtFromDate, dtToDate, OutOfSpec, blnShowInKg)