473,785 Members | 2,807 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

filtering which files can be opened

I have created a program that opens a file and counts words, characters,
sentences, etc. I have not used the open file dialog control found in the VB
..NET 2003 toolbox. I instead have used Open.ShowDialog (). What I want to do
is filter the open file so that only text files (*.txt) can be opened.

The project I am working with has two projects and one solution. The main
project uses Open as the variable for the Open file dialog. the The second
project uses Obj.Openfile.
May 27 '06 #1
3 1138
Charlie,

Can you show us a little piece of code.
Open.ShowDialog confuses me (and probably others as well), it means a form
that you have instanced as Open and shows it than.

Cor
"Charlie Brookhart" <ch************ ****@hotmail.co m> schreef in bericht
news:jO******** ************@ad elphia.com...
I have created a program that opens a file and counts words, characters,
sentences, etc. I have not used the open file dialog control found in the
VB
.NET 2003 toolbox. I instead have used Open.ShowDialog (). What I want to
do
is filter the open file so that only text files (*.txt) can be opened.

The project I am working with has two projects and one solution. The main
project uses Open as the variable for the Open file dialog. the The second
project uses Obj.Openfile.

May 27 '06 #2
"Charlie Brookhart" <ch************ ****@hotmail.co m> schrieb:
I have created a program that opens a file and counts words, characters,
sentences, etc. I have not used the open file dialog control found in the
VB
.NET 2003 toolbox. I instead have used Open.ShowDialog (). What I want to
do
is filter the open file so that only text files (*.txt) can be opened.


OpenFileDialog has a 'Filter' property...

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

May 27 '06 #3
Here is the code which is being used to open a file and then process words,
characters, etc. What I want to do is filter the file types so that only
text files can be opened.

Private Sub btnAnalyzeFile_ Click(ByVal sender As System.Object, ByVal e As
System.EventArg s) Handles btnAnalyzeFile. Click

Me.txtBoxInput. Clear()

Dim Open As New OpenFileDialog

Dim Obj As New Unit5ClassLibra ry.StringProces sor.StringProce ssor

Try

If Open.ShowDialog () = DialogResult.OK Then

Obj.Openfile(Op en.FileName)

Me.txtBoxCharac ters.Text = Obj.characters

Me.txtBoxWords. Text = Obj.words

Me.txtBoxSenten ce.Text = Obj.sentences

Me.txtBoxParagr aph.Text = Obj.paragraphs

End If

Catch er As Exception

MsgBox(er.Messa ge)

Finally

End Try

End Sub

"Herfried K. Wagner [MVP]" <hi************ ***@gmx.at> wrote in message
news:e$******** ******@TK2MSFTN GP05.phx.gbl...
"Charlie Brookhart" <ch************ ****@hotmail.co m> schrieb:
I have created a program that opens a file and counts words, characters,
sentences, etc. I have not used the open file dialog control found in the VB
.NET 2003 toolbox. I instead have used Open.ShowDialog (). What I want to
do
is filter the open file so that only text files (*.txt) can be opened.


OpenFileDialog has a 'Filter' property...

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

May 27 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

19
3573
by: William Wisnieski | last post by:
Hello Everyone, I have a main form with a datasheet subform that I use to query by form. After the user selects two criteria on the main form and clicks the cmdShowResults button on the main form, the subform returns the records based on the two criteria. The criteria used on the main form are values selected in two list boxes. When the user clicks on the first list box (lstCollege), it returns values in the second list box...
2
5473
by: Sean | last post by:
Greetings all, I am attempting to make a form that will filter through several tables that (I believe) have refretial integrity. I am pulling data from several tables into the form and i would like to eventually be able to filter down through the tables untill i can reach one unique record. I am creating a datbase to keep track of registered accounts for a stae program. Each account is registered into the program through a two...
1
3383
by: Jamal | last post by:
I am working on binary files of struct ACTIONS I have a recursive qsort/mergesort hybrid that 1) i'm not a 100% sure works correctly 2) would like to convert to iteration Any comments or suggestion for improvements or conversion to iteration would be much appreciated
6
2882
by: Jamal | last post by:
I am working on binary files of struct ACTIONS I have a recursive qsort/mergesort hybrid that 1) i'm not a 100% sure works correctly 2) would like to convert to iteration Any comments or suggestion for improvements or conversion to iteration would be much appreciated
15
4404
by: Richard Hollenbeck | last post by:
I tried to ask this question before on the 14th of January but I never got a reply. I'm still struggling with the problem. I'll try to rephrase the question: I have a crosstab query with rows of students and columns of activities and the data are the students' scores in each activity. No problem, almost. The problem is that there are five classes at the moment and will be more classes (or courses) in future semesters. I don't want...
12
8366
by: (Pete Cresswell) | last post by:
Say I've got a RecordSet: ----------------------------------------------------------- Set myRS = CurrentDB.OpenRecordset(SomeSQL, dbOpenDynaset) ----------------------------------------------------------- Is there any way to dynamically filter/unfilter/re-filter that RS without doing any .Opens or .Closes? -- PeteCresswell
8
13530
by: | last post by:
hi, i have a form on which a user can choose specific criteria such as dates etc, in order to filter the report that is called from the form. i do this by using the Where section of the docmd.openreport as follows DoCmd.OpenReport stDocName, acPreview, , strWhere where strWhere is a string dependant on the choices the user makes in the
8
2058
by: vinesh | last post by:
I have sample Asp.Net Web Application project. Let me know how to keep the files related to this project (like the webform.aspx, WebForm1.aspx.vb, WebForm1.aspx.resx) in a separate folder within a project and what all setting will I be required to do So that my original project works. Can I keep WebForm1.aspx in root and code behind file in a folder within the project folder? Thanks in advance.
10
3189
by: lancer6238 | last post by:
Hi all, I'm having programs reading from files. I have a text file "files.txt" that contains the names of the files to be opened, i.e. the contents of files.txt are Homo_sapiens.fa Rattus_norvegicus.fa (They are FA files that can be opened in any text editor.)
0
10336
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10155
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10095
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8978
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7502
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6741
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5513
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4054
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2881
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.