473,394 Members | 1,841 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

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 1122
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.com> schreef in bericht
news:jO********************@adelphia.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.com> 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.EventArgs) Handles btnAnalyzeFile.Click

Me.txtBoxInput.Clear()

Dim Open As New OpenFileDialog

Dim Obj As New Unit5ClassLibrary.StringProcessor.StringProcessor

Try

If Open.ShowDialog() = DialogResult.OK Then

Obj.Openfile(Open.FileName)

Me.txtBoxCharacters.Text = Obj.characters

Me.txtBoxWords.Text = Obj.words

Me.txtBoxSentence.Text = Obj.sentences

Me.txtBoxParagraph.Text = Obj.paragraphs

End If

Catch er As Exception

MsgBox(er.Message)

Finally

End Try

End Sub

"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:e$**************@TK2MSFTNGP05.phx.gbl...
"Charlie Brookhart" <ch****************@hotmail.com> 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
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...
2
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...
1
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...
6
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...
15
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...
12
by: (Pete Cresswell) | last post by:
Say I've got a RecordSet: ----------------------------------------------------------- Set myRS = CurrentDB.OpenRecordset(SomeSQL, dbOpenDynaset)...
8
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...
8
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...
10
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.