datagrid and text files
-
I would like to build a datagrid from a directory of text files. How do I get the files from the directory into the datagrid? Thank you, Silver-grey
silver-gray
-
I would like to build a datagrid from a directory of text files. How do I get the files from the directory into the datagrid? Thank you, Silver-grey
silver-gray
Why would you want to use such a heavy-weight control to display a list of filenames?
Dave Kreskowiak Microsoft MVP - Visual Basic
-
Why would you want to use such a heavy-weight control to display a list of filenames?
Dave Kreskowiak Microsoft MVP - Visual Basic
Because that is the User Specs. If you don't know a way to get the files in the directory and write them to another file name, Please don't comment. I thought that this was to help!! with the question:
silver-gray
-
Because that is the User Specs. If you don't know a way to get the files in the directory and write them to another file name, Please don't comment. I thought that this was to help!! with the question:
silver-gray
Silver-Grey wrote:
If you don't know a way to get the files in the directory and write them to another file name, Please don't comment.
OK, smart-ass...I just thought I would find out why the heavy wieght control needs to be used before I put the effort into commenting. Normally, a ListView is used for showing a list of filenames. Using a DataGrid for this is pretty odd, customer spec or no. I thought, "maybe this guy is a noobie and doesn't know any better. Let's find out first..." Well, here's one way to do it...
Dim files As String() = Directory.GetFiles(directoryPath)
DataGridView1.Columns.Add( New DataGridViewTextBoxColumn() )
For Each f As String in files
Dim fa As String() = {f}
DataGridView1.Rows.Add(fa)
NextThis is probably not the best way to do it, but hey. I work out the specs with the customer and don't let them make the mistake of dictating them to me. You're supposed to work with the customer to come up with a proper solution, not for the customer.
Dave Kreskowiak Microsoft MVP - Visual Basic
-
Silver-Grey wrote:
If you don't know a way to get the files in the directory and write them to another file name, Please don't comment.
OK, smart-ass...I just thought I would find out why the heavy wieght control needs to be used before I put the effort into commenting. Normally, a ListView is used for showing a list of filenames. Using a DataGrid for this is pretty odd, customer spec or no. I thought, "maybe this guy is a noobie and doesn't know any better. Let's find out first..." Well, here's one way to do it...
Dim files As String() = Directory.GetFiles(directoryPath)
DataGridView1.Columns.Add( New DataGridViewTextBoxColumn() )
For Each f As String in files
Dim fa As String() = {f}
DataGridView1.Rows.Add(fa)
NextThis is probably not the best way to do it, but hey. I work out the specs with the customer and don't let them make the mistake of dictating them to me. You're supposed to work with the customer to come up with a proper solution, not for the customer.
Dave Kreskowiak Microsoft MVP - Visual Basic
I don't have a datagridview in tool box. Using 2003 Visual Studio
silver-gray
-
I don't have a datagridview in tool box. Using 2003 Visual Studio
silver-gray
Great! More stuff I'm supposed to know without you explaining... Let's see, my old .NET 1.x DataGrid is a bit rusty, but...
Dim files As String() = Directory.GetFiles(directoryPath)
Dim fa As New ArrayList()
fa.AddRange(files)
DataGrid1.DataSource = faDave Kreskowiak Microsoft MVP - Visual Basic
-
Great! More stuff I'm supposed to know without you explaining... Let's see, my old .NET 1.x DataGrid is a bit rusty, but...
Dim files As String() = Directory.GetFiles(directoryPath)
Dim fa As New ArrayList()
fa.AddRange(files)
DataGrid1.DataSource = faDave Kreskowiak Microsoft MVP - Visual Basic
That didn't work. I guess I will have to use a listbox. I can get data inti it. Now trying to select data out of it and write a new file with a different name. Silver-grey
silver-gray