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

Help needed in using FSO's, TextStreams, etc. --- Code Review and Advice requested

Hello All,

I'd like your comments on the code below. The sub does exactly what I want it to do but I don't feel that it is solid as all. It seems like I'm
using some VB6 code, .Net2003 code, and .Net2005 code. I'm developing in vb.net 2005.

This test sub just reads an input text file, writing out records to another text file, eliminating records that have a '99' in them (it is similar to
a CSV file).

Some of my concerns are:

1, 'writeline' does not convert to upper/lower case when keyed in - am I missing a reference?
2. Am I unnecessarily setting too many objects to '= Nothing'?
3. The 'Rename' statement seems like VB6 - isn't there a textstream rename?

I want to do this the vb.net way as much as possible, but it seems that while searching the net that I wind up with a mix of VB6, Net2003 and Net2005
code.

I appreciate your help,

Hexman
Private Sub RemoveRecs()
'************************************************* ****************************
' This routine reads the .pgh file and eliminates any records that have a '99'
' in them. An output file is created (without the 99's), the original file is
' deleted and the new file is renamed to the original.
'************************************************* ****************************
Const ForReading = 1
Const ForWriting = 2
Dim FSO ' A File Scripting object
Dim FSO1 ' A File Scripting object
Dim TSI ' Input Text Stream
Dim TSO ' Output Text Stream
Dim strRecord As String
Dim InFileName As String
Dim OutFileName As String
Dim AnyChanges As Boolean

AnyChanges = False
InFileName = "C:\jjj.txt"
OutFileName = "c:\kkk.txt"
FSO = CreateObject("Scripting.FileSystemObject")
FSO1 = CreateObject("Scripting.FileSystemObject")
TSI = FSO.OpenTextFile(InFileName, ForReading, True)
TSO = FSO1.opentextfile(OutFileName, ForWriting, True)
Do While TSI.AtEndOfStream <True
strRecord = TSI.ReadLine
If InStr(1, strRecord, "99") = 0 Then
TSO.writeline(strRecord)
Else
AnyChanges = True
End If
Loop
TSI.Close()
TSO.close()
If AnyChanges Then
TSI = FSO.GetFile(InFileName)
TSI.Delete()
Rename(OutFileName, InFileName)
Else
TSO = FSO.GetFile(OutFileName)
TSO.Delete()
End If
FSO = Nothing 'Clean up - destroy objects
FSO1 = Nothing
TSI = Nothing
TSO = Nothing
End Sub
Nov 22 '06
53 4580
yeah it will take about 10 of you to stand up to me... and you'll still
all get the beat down

-Aaron

The Grim Reaper wrote:
Give us your address, and I'm sure a few of us will come and visit you.
(If only to see what kind of "thing" can produce such convoluted rubbish on
a daily basis...)

<aa*********@gmail.comwrote in message
news:11**********************@80g2000cwy.googlegro ups.com...
you mother fucking stupid ass bitch you specifically said 'ms cant
censor these newsgroups'

and Im here to tell you from first hand experience that they DO CENSOR
and they STARTED CENSORING LONG BEFORE I STARTED SWEARING.

I just posted several directly to news.microsoft.com through MSIMN
(outlook express) under the alias 'jello_world' these showed up
perfectly

anything-- anything in the world-- that I post under my typical aliases
is stricken from the server immediately.

that, my friend constitutes censorship; and this is a testcase that
illustrates these facts.

you, my mother fucking asshole --- are calling me a liar
and I dare you to say those words to my face, fucknut

-Aaron
C-Services Holland b.v. wrote:
aa*********@gmail.com wrote:
eat a mother fucking dick asshole

Your sexual preference is of no interest to me.

how dare you accuse me of being a LIAR?

I didn't call you a liar, I just pointed out a flaw.

i can't post anything through any interface that shows up on ms
newsgroups news.microsoft.com

they censored me even before I started swearing

With the behaviour you've show here, I can imagine you've been denied
access to MS owned servers. that does not mean you're denied access to
the newsgroups or unable to post to MS newsgroups.. obviously, otherwise
your message wouldn't even show up here.


piece of shit ass mother fucking company can lick my balls

As before, your sexual fantasies are of no interest to me.

Get some valium, get a life and move on. There's no sense in giving
yourself a heartattack over this.
--
Rinze van Huizen
C-Services Holland b.v
Dec 5 '06 #51
aa*********@gmail.com wrote:
you mother fucking stupid ass bitch you specifically said 'ms cant
censor these newsgroups'

and Im here to tell you from first hand experience that they DO CENSOR
and they STARTED CENSORING LONG BEFORE I STARTED SWEARING.

I just posted several directly to news.microsoft.com through MSIMN
(outlook express) under the alias 'jello_world' these showed up
perfectly

anything-- anything in the world-- that I post under my typical aliases
is stricken from the server immediately.

that, my friend constitutes censorship; and this is a testcase that
illustrates these facts.

you, my mother fucking asshole --- are calling me a liar
and I dare you to say those words to my face, fucknut

-Aaron

The fact that I am replying to your messages is proof that MS can't
sensor these newsgroups. So yes, in that respect you're a liar. Don't
think threatning me with physical violence is making any impact at all.

Oh and here's a word for you...*PLONK*
--
Rinze van Huizen
C-Services Holland b.v
Dec 6 '06 #52
I disagree fucknut

what interface are you using anyways?

I can post to news.microsoft.com under my real emails and nothing ever
ever ever gets posted.

if i say something positive and constructive; it doesn't show up

so MSFT has 'blackballed some of my email addresses'

and if you don't believe me then you need to fly out here and call me a
liar right to my face.

BECAUSE IVE SEEN IT EVERY DAY FOR THE PAST WHAT.. 3 YEARS?

-Aaron
C-Services Holland b.v. wrote:
aa*********@gmail.com wrote:
you mother fucking stupid ass bitch you specifically said 'ms cant
censor these newsgroups'

and Im here to tell you from first hand experience that they DO CENSOR
and they STARTED CENSORING LONG BEFORE I STARTED SWEARING.

I just posted several directly to news.microsoft.com through MSIMN
(outlook express) under the alias 'jello_world' these showed up
perfectly

anything-- anything in the world-- that I post under my typical aliases
is stricken from the server immediately.

that, my friend constitutes censorship; and this is a testcase that
illustrates these facts.

you, my mother fucking asshole --- are calling me a liar
and I dare you to say those words to my face, fucknut

-Aaron

The fact that I am replying to your messages is proof that MS can't
sensor these newsgroups. So yes, in that respect you're a liar. Don't
think threatning me with physical violence is making any impact at all.

Oh and here's a word for you...*PLONK*
--
Rinze van Huizen
C-Services Holland b.v
Dec 6 '06 #53
I'm not a bully, I am the savior of the unclean; I am the great eraser

I speak the truth.

VB.net is going away
it is now called VB 2005 ROFL

-Larry Linson JR
RobinS wrote:
The agency who gave me that information provides employment
statistics to the government, who in turn use it in government
reports.

As for the second part, it doesn't surprise me that your personal
parts are so small. It explains what you're trying to make up for
by being a bully.

Have a nice day!
Robin S.

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

"Larry Linson" <la***********@hotmail.comwrote in message
news:11**********************@16g2000cwy.googlegro ups.com...
dude that's the most ridiculous statistic I've ever heard of in my
life.

I think that I could jam 98% of my cock in your mouth.. does that make
you a girl?

-Larry



RobinS wrote:
I have been informed by a headhunting agency that .Net
programmers have a 97.5% employment rate. That means
there are only 2.5% unemployed, most of them by choice.
Judging by the number of headhunters that continue to
show up at my local .Net User Group meetings, I think
your percentages are off, or a lot more VB6 programmers
are going to move up to VB2005 to stay employed.

Robin S.
----------------------------------------------

"Larry Linson" <la***********@hotmail.comwrote in message
news:11**********************@h54g2000cwb.googlegr oups.com...
people like to use VB.net?

ROFL

what universe do you come from?

show me some stats.. and I'll show you some stats that say '90% of vb
developers still use VB6'

I would notify the folks at Monster.com and craigslist.org/job because
I sure don't see many VB.net _JOBS_

-Larry
Tim Patrick wrote:
Except for item #d (which is just a side effect of your overall bad
feeling),
I fully understand your frustration. (By the way,
"microsoft.com/vbasic"
does go to the Visual Basic page; I agree that "microsoft.com/vb"
should
as well.)

Concerning items #g through #i: I can tell you how to become rich
beyond
your wildest dreams. Start a company that fully supports those who
wish
to
continue with VB6. Make a name for yourself, and then approach
Microsoft
about licensing the VB6 product and its source code for support and
enhancement
purposes. Everyone always says Microsoft only cares about money; go
ahead
and prove it. Convince them that it is in their financial best
interest
to
allow your new company to extend Visual Basic Classic.

You can draw a lot more flies with honey than you can with vinegar.
Using
the keyboard to constantly browbeat another product that, frankly, a
lot
of people actually like to use is insanity. These forums have no
influence
on Microsoft's business decisions. But a well-crafted business plan
just
might.

-----
Tim Patrick - www.timaki.com
Start-to-Finish Visual Basic 2005

well... i'll make you a deal buddy

when microsoft does this:

a) microsoft.com/vb should GO SOMEWHERE
b) NO vs crashes in a month for me
c) _EVERY_SINGLE_PROGRAMMING_EXAMPLE_ is in both C# and VB.net
d) vb newsgroup should be public.microsoft.vb.. not this
'microsoft.public.dotnet.languages.vb' crap
e) it isn't verbose like 2002,2003,2005
f) i can copy and paste datasets in SSRS in between reports
g) they support vb6
h) they support developing new COM components
i) they support existing ActiveX controls
if all those come true; I might lay off...

but until then; their backwards ass crap; i've just about had enough
of it

Tim Patrick wrote:

So when the next version of Visual Studio comes out and includes
Visual Basic--and
it will, since I've already tried out an early version of it--will
you promise
to leave these forums with the shame of a false prophet and never
post again?
One can only hope.
Jan 5 '07 #54

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

Similar topics

3
by: Arvie | last post by:
I need some advice guys.. I am proposing that we get someone to do a complete audit/review of our Java application codebase, about 1000 JSPs/Servlets and 100 EJBs. If I get firms to submit...
1
by: wtnt | last post by:
Hello. I've searched all over and haven't seen another thread with this problem. Please bear with me as I try to explain. thanks. :) I have some programs that need to be cross-platform...
9
by: Adam Monsen | last post by:
I kindly request a code review. If this is not an appropriate place for my request, where might be? Specific questions are in the QUESTIONS section of the code. ...
1
by: Tony Ciconte | last post by:
I have a table of customers who may have purchased numerous types of products. Finding out who purchased what is easy. However, what I need to determine is which customer has purchased ONLY one or...
8
by: pmm | last post by:
hi all , I am working on a router which is Coded in ansi C ,it uses number of semaphores,threads I want to know that how can we know what threads are currently alive in a program being executed...
1
by: Peter Williams | last post by:
Hello All, I'm a newbie to this ng. I'm posting here because I have a question about debugging some javascript on some pages of my website. Please don't call me a "troll" -- because I'm not one....
4
by: Dave Harry | last post by:
I found the RS232 class from MS's 101 VB samples. Writing to the port works fine. (I've got hyperterminal on the other comm port and a crossover cable between COM1 and COM2) The port is opened...
7
by: Emma Burrows | last post by:
Hello all, I've been writing C# applications and web sites for some time, but I'm now planning to share my latest code with the world at www.codeproject.com. The code works fine, but I'd like...
1
by: sumanthsclsdc | last post by:
hello friends, i am using the os.path.walk to search to filter the files with the given word, this function i m using in many modules. i just want to place this function in some class...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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
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: 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...

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.