Tevin says:
Private
Sub
GetLast10Average()
Dim
dtFromDate
As
DateTime = Convert.ToDateTime(txtFrom.Text)
Dim
dtToDate
As
DateTime = Convert.ToDateTime(txtTo.Text)
Dim
strStockCode
As
String
= Microsoft.VisualBasic.Left(txtComponents.Text, InStr(1, txtComponents.Text,
" : "
))
Dim
blnOutOfSpec = chkOutOfSpec.Checked =
True
mCWC =
New
aplComponentWeightChecks(My.Settings.Quality)
Dim
dtGetLast10Average
As
DataTable = mCWC.GetLast10Average(strStockCode)
rpComponentWeightResults.DataSource = dtGetLast10Average
rpComponentWeightResults.DataBind()
End
Sub
Use DataTable.Rows.Count. Use below code.
Private Sub GetLast10Average()
Dim dtFromDate As DateTime = Convert.ToDateTime(txtFrom.Text)
Dim dtToDate As DateTime = Convert.ToDateTime(txtTo.Text)
Dim strStockCode As String = Microsoft.VisualBasic.Left(txtComponents.Text, InStr(1, txtComponents.Text, " : "))
Dim blnOutOfSpec = chkOutOfSpec.Checked = True
mCWC = New aplComponentWeightChecks(My.Settings.Quality)
Dim dtGetLast10Average As DataTable = mCWC.GetLast10Average(strStockCode)
If dtGetLast10Average.Rows.Count < 10 Then
ClientScript.RegisterStartupScript(Me.GetType(), "", "alert('Error Message')", True)
Else
rpComponentWeightResults.DataSource = dtGetLast10Average
rpComponentWeightResults.DataBind()
End If
End Sub