Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27554

Searching in datagrid

$
0
0
Hi all,

I'm trying to make a login form with VB but I'm having some trouble with searching through the datagrid.

Code:

        Dim blnValid As Boolean
        Dim intTeller As Integer
        'Dim intTeller As Integer
        intTeller = EasybyteDataSet.Gebruikers.Rows.Count
        MessageBox.Show(intTeller)
        For intI = 0 To intTeller - 1
            If txtNaam.Text <> EasybyteDataSet.Gebruikers.Rows(intI).Item("Naam") Then
                blnValid = False
            Else
                For intJ = 0 To intTeller - 1
                    If txtWachtwoord.Text <> EasybyteDataSet.Gebruikers.Rows(intJ).Item("Password") Then
                        blnValid = False
                    Else
                        blnValid = True
                    End If
                    Exit For
                Next
                Exit For
            End If
        Next
        If blnValid = True Then
            gstrNaam = txtNaam.Text
            txtNaam.Text = ""
            txtWachtwoord.Text = ""
            cntTeller.Enabled = True
        Else
            MessageBox.Show("Gebruikersnaam en/of wachtwoord bestaat niet", "Fout", MessageBoxButtons.OK, MessageBoxIcon.Error)
            txtWachtwoord.Text = ""
        End If

I can login with the first name and password the the database but as soon as I try another name, it shows the messagebox.

Can anyone help me out?
Thanks in advance

Viewing all articles
Browse latest Browse all 27554

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>