Solved

bind text file name(directory) into a dataset

Posted on 2006-06-18
4
246 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
  • 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 500 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

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

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

I think the Typed DataTable and Typed DataSet are very good options when working with data, but I don't like auto-generated code. First, I create an Abstract Class for my DataTables Common Code.  This class Inherits from DataTable. Also, it can …
Introduction As chip makers focus on adding processor cores over increasing clock speed, developers need to utilize the features of modern CPUs.  One of the ways we can do this is by implementing parallel algorithms in our software.   One recent…
In a recent question (https://www.experts-exchange.com/questions/28997919/Pagination-in-Adobe-Acrobat.html) here at Experts Exchange, a member asked how to add page numbers to a PDF file using Adobe Acrobat XI Pro. This short video Micro Tutorial sh…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

831 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