473,395 Members | 1,972 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,395 software developers and data experts.

FSO and Cussing

Hi All:

I have been reading and hearing you cuss over that many of you do not use
scripting and the File System Object for opening and closing forms. Since
this is the only way that I know how to code for opening and closing form in
both VB.net and VB 6, would someone please enlighten me as to how to check to
see if a file exists, open a text file and read it's contents into a database
in VB.net code? If
there is a newer better way of doing this I would appreciate learning.

Rachel

Nov 21 '05 #1
7 1199
http://msdn.microsoft.com/library/de...swithvbnet.asp

If System.IO.File.Exists(path) Then
End If

' Open the stream and read it back.
Dim sr As System.IO.StreamReader
Try
sr = System.IO.File.OpenText("c:\test.txt")

Dim s As String
s = sr.ReadLine
Do While Not s = Nothing
Debug.WriteLine(s)
s = sr.ReadLine
Loop

Finally
sr.Close()
End Try

Greg

"Rachel" <Ra****@discussions.microsoft.com> wrote in message
news:00**********************************@microsof t.com...
Hi All:

I have been reading and hearing you cuss over that many of you do not use
scripting and the File System Object for opening and closing forms. Since
this is the only way that I know how to code for opening and closing form in both VB.net and VB 6, would someone please enlighten me as to how to check to see if a file exists, open a text file and read it's contents into a database in VB.net code? If
there is a newer better way of doing this I would appreciate learning.

Rachel

Nov 21 '05 #2
Hi,

http://msdn.microsoft.com/library/de...xiststopic.asp

Ken
--------------------------------
"Rachel" <Ra****@discussions.microsoft.com> wrote in message
news:00**********************************@microsof t.com...
Hi All:

I have been reading and hearing you cuss over that many of you do not use
scripting and the File System Object for opening and closing forms. Since
this is the only way that I know how to code for opening and closing form in
both VB.net and VB 6, would someone please enlighten me as to how to check
to
see if a file exists, open a text file and read it's contents into a
database
in VB.net code? If
there is a newer better way of doing this I would appreciate learning.

Rachel
Nov 21 '05 #3
File.OpenText Method

http://msdn.microsoft.com/library/de...nTextTopic.asp

Remarks:
This method is equivalent to StreamReader(String).

This always confused me at first.

Greg

"Greg Burns" <greg_burns@DONT_SPAM_ME_hotmail.com> wrote in message
news:uC**************@TK2MSFTNGP12.phx.gbl...
http://msdn.microsoft.com/library/de...swithvbnet.asp
If System.IO.File.Exists(path) Then
End If

' Open the stream and read it back.
Dim sr As System.IO.StreamReader
Try
sr = System.IO.File.OpenText("c:\test.txt")

Dim s As String
s = sr.ReadLine
Do While Not s = Nothing
Debug.WriteLine(s)
s = sr.ReadLine
Loop

Finally
sr.Close()
End Try

Greg

"Rachel" <Ra****@discussions.microsoft.com> wrote in message
news:00**********************************@microsof t.com...
Hi All:

I have been reading and hearing you cuss over that many of you do not use scripting and the File System Object for opening and closing forms. Since this is the only way that I know how to code for opening and closing
form in
both VB.net and VB 6, would someone please enlighten me as to how to
check to
see if a file exists, open a text file and read it's contents into a

database
in VB.net code? If
there is a newer better way of doing this I would appreciate learning.

Rachel


Nov 21 '05 #4
Ken:

Thanks for your help. This method works for file and folder exists and
creating folders and files. Do you have any ideas of how I could do this?

strNameOfFile = fso.GetFileName(SaveFileDialog.FileName)
Rachel
"Ken Tucker [MVP]" wrote:
Hi,

http://msdn.microsoft.com/library/de...xiststopic.asp

Ken
--------------------------------
"Rachel" <Ra****@discussions.microsoft.com> wrote in message
news:00**********************************@microsof t.com...
Hi All:

I have been reading and hearing you cuss over that many of you do not use
scripting and the File System Object for opening and closing forms. Since
this is the only way that I know how to code for opening and closing form in
both VB.net and VB 6, would someone please enlighten me as to how to check
to
see if a file exists, open a text file and read it's contents into a
database
in VB.net code? If
there is a newer better way of doing this I would appreciate learning.

Rachel

Nov 21 '05 #5
Thanks for your help. This method works for file and folder exists and
creating folders and files. Do you have any ideas of how I could do this?

strNameOfFile = fso.GetFileName(SaveFileDialog.FileName)
Rachel

"Greg Burns" wrote:
http://msdn.microsoft.com/library/de...swithvbnet.asp

If System.IO.File.Exists(path) Then
End If

' Open the stream and read it back.
Dim sr As System.IO.StreamReader
Try
sr = System.IO.File.OpenText("c:\test.txt")

Dim s As String
s = sr.ReadLine
Do While Not s = Nothing
Debug.WriteLine(s)
s = sr.ReadLine
Loop

Finally
sr.Close()
End Try

Greg

"Rachel" <Ra****@discussions.microsoft.com> wrote in message
news:00**********************************@microsof t.com...
Hi All:

I have been reading and hearing you cuss over that many of you do not use
scripting and the File System Object for opening and closing forms. Since
this is the only way that I know how to code for opening and closing form

in
both VB.net and VB 6, would someone please enlighten me as to how to check

to
see if a file exists, open a text file and read it's contents into a

database
in VB.net code? If
there is a newer better way of doing this I would appreciate learning.

Rachel


Nov 21 '05 #6
Hi,

Dim strFileName As String =
System.IO.Path.GetFileName(SaveFileDialog1.FileNam e)

Ken

---------------------

"Rachel" <Ra****@discussions.microsoft.com> wrote in message
news:7C**********************************@microsof t.com...
Ken:

Thanks for your help. This method works for file and folder exists and
creating folders and files. Do you have any ideas of how I could do this?

strNameOfFile = fso.GetFileName(SaveFileDialog.FileName)
Rachel
"Ken Tucker [MVP]" wrote:
Hi,

http://msdn.microsoft.com/library/de...xiststopic.asp

Ken
--------------------------------
"Rachel" <Ra****@discussions.microsoft.com> wrote in message
news:00**********************************@microsof t.com...
Hi All:

I have been reading and hearing you cuss over that many of you do not use
scripting and the File System Object for opening and closing forms. Since
this is the only way that I know how to code for opening and closing form
in
both VB.net and VB 6, would someone please enlighten me as to how to check
to
see if a file exists, open a text file and read it's contents into a
database
in VB.net code? If
there is a newer better way of doing this I would appreciate learning.

Rachel

Nov 21 '05 #7
Thanks Ken I am cussing no longer!

"Ken Tucker [MVP]" wrote:
Hi,

Dim strFileName As String =
System.IO.Path.GetFileName(SaveFileDialog1.FileNam e)

Ken

---------------------

"Rachel" <Ra****@discussions.microsoft.com> wrote in message
news:7C**********************************@microsof t.com...
Ken:

Thanks for your help. This method works for file and folder exists and
creating folders and files. Do you have any ideas of how I could do this?

strNameOfFile = fso.GetFileName(SaveFileDialog.FileName)
Rachel
"Ken Tucker [MVP]" wrote:
Hi,

http://msdn.microsoft.com/library/de...xiststopic.asp

Ken
--------------------------------
"Rachel" <Ra****@discussions.microsoft.com> wrote in message
news:00**********************************@microsof t.com...
Hi All:

I have been reading and hearing you cuss over that many of you do not use
scripting and the File System Object for opening and closing forms. Since
this is the only way that I know how to code for opening and closing form
in
both VB.net and VB 6, would someone please enlighten me as to how to check
to
see if a file exists, open a text file and read it's contents into a
database
in VB.net code? If
there is a newer better way of doing this I would appreciate learning.

Rachel


Nov 21 '05 #8

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

Similar topics

0
by: Jootec from Mars | last post by:
For about a month now I've been ripping my hair out and cussing a lot as to why PHP4 running on my Win2K dev box has not been writing the $_SESSION variable correctly to session.save_path at the...
43
by: Dom | last post by:
can someone please help me display text in the console cout << "Testing"; in a different colour to the default one
1
by: David. E. Goble | last post by:
Hi all; I have the following files; index.html, sigsheader.js, sigsboby.js, smilesbody.js and smiles.js. The sourse is below. The page displays two manual slide shows... Each slideshow has a set...
7
by: David. E. Goble | last post by:
Hi all; I have the following files; index.html, sigsheader.js, sigsboby.js, smilesbody.js and smiles.js. The sourse is below. The page displays two manual slide shows... Each slideshow has a set...
14
by: Kay Schluehr | last post by:
One of the main reasons Pythons anonymous function lambda is considered to be "broken" is Pythons disability to put statements into expressions and support full functionality. Many attempts to...
12
by: Xah Lee | last post by:
would anyone like to translate the following perl script to Python or Scheme (scsh)? the file takes a inpath, and report all html files in it above certain size. (counting inline images) also...
9
by: David. E. Goble | last post by:
Arrrh! some buttons work while others don't, but I can't see why. I have tried comparing the files that do work, with the ones that don't. But to no help. The funny thing is the parts that work...
2
by: Al | last post by:
Hi, Is there any way to replace a character at a position? Without cussing the RichTextBox to scroll. For example the following code will replaces the by removing but the side effect is that it...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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,...

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.