This is the first time that I have tried to loop through a datatable. I know there are better methods to count rows but I was making sure that the loop worked. My next step is to take a value (TextBox1) and compare it to a value in each row of the datatable (tbl_WinningNumbers).
The problem is the syntax that I have bolded between the If Then part of the statement. It seems that all the tutorials and examples I find do not any reference to objects such as a textboxes, datatables, etc.
Thanks for any help
VB.NET:
[FONT=Courier New][FONT=Courier New][COLOR=blue][FONT=Courier New][COLOR=blue]Dim tbl_WinningDrawing As New DataTable()[/COLOR][/FONT]
[FONT=Courier New][COLOR=blue]Dim Dr As DataRow[/COLOR][/FONT]
[FONT=Courier New][COLOR=blue]Dim Count As Int16[/COLOR][/FONT]
[FONT=Courier New][COLOR=blue]OleDbDataAdapter1.Fill(tbl_WinningDrawing)[/COLOR][/FONT]
[FONT=Courier New][COLOR=blue]OleDbDataAdapter1.Fill(DataSet11)[/COLOR][/FONT]
[FONT=Courier New][COLOR=blue]Count = 0[/COLOR][/FONT]
[FONT=Courier New][COLOR=blue]For Each Dr In tbl_WinningDrawing.Rows[/COLOR][/FONT]
[FONT=Courier New][COLOR=blue] [B]If Me.TextBox1.Text Is Me.DataSet11.tbl_WinningNumbers.WinningDrawingColumn Then[/B][/COLOR][/FONT]
[FONT=Courier New][COLOR=blue] Count = Count + 1[/COLOR][/FONT]
[FONT=Courier New][COLOR=blue]End If[/COLOR][/FONT]
[FONT=Courier New][COLOR=blue]Next[/COLOR][/FONT]
[/COLOR][/FONT][/FONT]
The problem is the syntax that I have bolded between the If Then part of the statement. It seems that all the tutorials and examples I find do not any reference to objects such as a textboxes, datatables, etc.
VB.NET:
[FONT=Courier New][B][COLOR=blue][FONT=Courier New]If[/FONT][/COLOR][FONT=Courier New] [COLOR=blue]Me[/COLOR].TextBox1.Text [COLOR=blue]Is[/COLOR] [COLOR=blue]Me[/COLOR].DataSet11.tbl_WinningNumbers.WinningDrawingColumn [COLOR=blue]Then[/COLOR][/FONT][/B][/FONT]
Thanks for any help
Last edited: