I'm working on converting a VB6 App with a MSFlexGrid to .NET.
I need to load a DataGrid from a 3-field CSV file. Actually, several 3-field CSV files, but I want each file to be collapsable into a header bar with the name of the CSV file.
Is this possible? Is there example code available? Or any hints?
Do you only want to show it or also want to update it? (Because I can give you a simple method, but that makes it in my opinion more difficult when you want to do updates).
> Do you only want to show it or also want to update it? > (Because I can give you a simple method, but that makes it in my opinion > more difficult when you want to do updates).
I think a complete sample but partialy typed in here, so try it. Keep in mind that your CSV file has to be in your global setting style from the computer you use.
I hope this helps?
Cor
\\\\ Private Sub Form1_Load(ByVal sender As Object, _ ByVal e As System.EventArgs) Handles MyBase.Load Dim file As String = "Test2.txt" Dim path As String = "C:\Test1\" Dim ds As New DataSet Try Dim f As System.IO.File If f.Exists(path & file) Then Dim ConStr As String = _ "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & _ path & ";Extended Properties=""Text;HDR=No;FMT=Delimited\""" Dim conn As New OleDb.OleDbConnection(ConStr) Dim da As New OleDb.OleDbDataAdapter("Select * from " & _ file, conn) da.Fill(ds, "TextFile") End If Catch ex As Exception MessageBox.Show(ex.ToString) End Try dim dv as new dataview(ds.Tables(0) dv.AllowNew = False ' this is to prevent the last row in the grid DataGrid1.DataSource = dv DataGrid1.ReadOnly = True End Sub ///