I'm working through the tutorials in the Wrox
VB 2005 starter kit and there's some code that doesn't seem to work. It's the code to check that the user has entered a password correctly on the login screen:
Dim CheckUserDataView As DataView = CheckUserTable.DefaultView
CheckUserDataView.RowFilter = "Name = '" + UserName + "'"
With CheckUserDataView
If .Count > 0 Then
If .Table.Rows(0).Item("Password").ToString.Trim = Password Then
Return True
Else
MessageBox.Show(.Table.Rows(0).Item("Password").To String.Trim)
Return False
End If
Else
Return False
End If
End With
I can see how it should work, but for some reason it always picks the first row from the unfiltered table. In other words, CheckUserDataView.Count is 1, but there seems to be more than 1 item in the filtered dataview. As far as I can see, using the .Table.Rows method returns items from the unfiltered dataview and I can't understand why this should be happening.
Anybody know what's going on?