hi everyone
my question is how to clear a datagrid view in vb.net 2010
i have tried DatGridView1.Clear() but it only works once
and i would like to clear my datagrid every time i click the load button
hers my code
Private Sub Button15_Click(sender As System.Object, e As System.EventArgs) Handles Button15.Click
OpenFileDialog1.Title = "Please Select a File"
OpenFileDialog1.InitialDirectory = "C:temp"
OpenFileDialog1.ShowDialog()
End Sub
Private Sub OpenFileDialog1_FileOk(sender As System.Object, e As System.ComponentModel.CancelEventArgs) Handles OpenFileDialog1.FileOk
dgQuotation.DataSource = Nothing
Dim strm As System.IO.Stream
strm = OpenFileDialog1.OpenFile()
strPath = OpenFileDialog1.FileName
If Not (strm Is Nothing) Then
dgQuotation.DataSource = Nothing
' Dim col As New DataGridViewTextBoxColumn
'column declaration
dgQuotation.ColumnCount = 43
columnDeclaration()
For Each line As String In System.IO.File.ReadAllLines(strPath)
dgQuotation.Rows.Add(line.Split("!"))
Next
strm.Close()
End If
End Sub