?
Solved

bind text file name(directory) into a dataset

Posted on 2006-06-18
4
Medium Priority
?
252 Views
Last Modified: 2010-04-23
Hi Experts,

Would like to bind some of the text files from fixed directory into a dataset. How can i do it??? Pls provide me the code..

0
Comment
Question by:nyee84
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 

Author Comment

by:nyee84
ID: 16929577
experts pls help
0
 
LVL 34

Expert Comment

by:Sancler
ID: 16929835
I am not sure if I am alone in this, but I don't understand your question.

Normally, a reference to "binding" involves the linking of some property of some control/s with data that is held in a datasource.  Although there can be a variety of datasources, a dataset is not one of them (although a datatable within a dataset can be).

What you are asking about, however, is "binding" some files to a dataset.  Files are not controls that can be "bound" in the sense that I have just described, and a dataset is not a datasource to which controls can, anyway, be "bound" in that sense.

So what is it you are actually trying to do?  Do you want to create a datasource containing file names (and perhaps other details of the files) and bind some control - e.g. a listbox - to that?  Or are you trying to create a datasource for which the data comes from some text file/s and bind some control - e.g. a textbox - to that?  Or what?

And what version of VB.NET are you using?

Roger
0
 

Author Comment

by:nyee84
ID: 16929859
Hi Roger,

I am using .net framework 1.1 and basically my program checking content of  text files in a directory and some reasons i need to display the some of the text files name in a datagrid.

I need to store the text filenames in a datatable so that i can do databinding and can display in a  grid and it was very unfortunate that i dont know how to store txtfile name in a datatable so that i can do a databing to my grid.

Pls advice
0
 
LVL 34

Accepted Solution

by:
Sancler earned 2000 total points
ID: 16930273
Try this

One form with one datagrid on it.  Just this code

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim myDir As System.IO.DirectoryInfo = New System.IO.DirectoryInfo("c:\")
        Dim Files() As System.IO.FileInfo = myDir.GetFiles("*.txt")
        DataGrid1.DataSource = Files
    End Sub

You will obviously need to play with it.  For instance, the directory it reads is c:\ and I imagine you will want to change that.  And the datagrid shows more information than you might need.  But it illustrates a simple way of displaying file information in a datagrid.  Will that, with suitable adjustments, do what you want?

Roger
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

1.0 - Introduction Converting Visual Basic 6.0 (VB6) to Visual Basic 2008+ (VB.NET). If ever there was a subject full of murkiness and bad decisions, it is this one!   The first problem seems to be that people considering this task of converting…
It’s quite interesting for me as I worked with Excel using vb.net for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question