清除DataGridView visual studio

时间:2015-01-21 10:11:07

标签: vb.net visual-studio-2012 datagridview

嗨我已经将cvs文件链接到我的帐户检查程序,但是当我按下重置按钮时需要数据视图清除,该按钮会重置电子邮件和密码字段,但我需要它来重置数据查看器,否则人员帐户信息保持不变屏幕可以有人帮忙吗?

Imports System.Text.RegularExpressions



Public Class Form1

Private Sub Label1_Click(sender As Object, e As EventArgs)

End Sub 

Private Sub TextBox1_TextChanged(sender As Object, e As EventArgs) Handles     AddressBox1.TextChanged
        End Sub 





Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click 
    Dim currentRow As String()

    Dim foundmatch As Boolean 

    Using parserDetails As New Microsoft.VisualBasic.FileIO.TextFieldParser("A453_datafile_4.csv") 
        parserDetails.SetDelimiters(",") 

        While Not parserDetails.EndOfData
            currentRow = parserDetails.ReadFields() 

            If AddressBox1.Text = currentRow(0) And TextBox2.Text = currentRow(1) Then
                Me.DataGridView1.Rows.Add(currentRow)
                foundmatch = True
            End If

        End While
    End Using

    If Not foundmatch Then
        MsgBox("The email or password you have enterd is incorrect", MsgBoxStyle.Critical, "Invalid Email")
    End If

End Sub


Private Sub DataGridView1_CellContentClick(sender As Object, e As DataGridViewCellEventArgs)

End Sub

Private Sub DataGridView1_CellContentClick_1(sender As Object, e As DataGridViewCellEventArgs) Handles DataGridView1.CellContentClick

End Sub

Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load

End Sub

Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
    AddressBox1.Text = Nothing
    TextBox2.Text = Nothing
End Sub

Private Sub Label1_Click_1(sender As Object, e As EventArgs) Handles Label1.Click

End Sub

Private Sub TextBox2_TextChanged(sender As Object, e As EventArgs) Handles TextBox2.TextChanged

End Sub

Private Sub TextBox1_TextChanged_1(sender As Object, e As EventArgs)

End Sub

Private Sub Label2_Click(sender As Object, e As EventArgs) Handles Label2.Click

End Sub
End Class

0 个答案:

没有答案