Wrox Home  
Search P2P Archive for: Go

  Return to Index  

pro_vb thread: Program Freeze... Help Urgent!


Message #1 by "Sidney Fuerte" <fuertsj1104@y...> on Mon, 26 Aug 2002 22:13:24
No problem.  

We are all here to help.  I remember when I first started programming,
Compuserve was really the only true ISP out there.  No forums to
discusss problems, you either developed your own routines or you sank.

I now have 8 different languages under my belt and willb adding VB.NTE
next.

MANOJ SHARMA wrote:
> 
> My apologies to john....
> 
> Matt.... thanks..  i was drunk... :(
> 
> Manoj
> 
> ----- Original Message -----
> From: "Matt Morgan" <mmorgan63@c...>
> To: "professional vb" <pro_vb@p...>
> Sent: Wednesday, August 28, 2002 11:42 AM
> Subject: [pro_vb] RE: Program Freeze... Help Urgent!
> 
> > Manoj -
> >
> > I think you have your threads confused a bit - I had the meaningless
> ideas,
> > John's answer was the solution * among many *.
> >
> > Damn it's good to see people working together ...
> >
> > Drunk again,
> > Matt
> >
> > ----- Original Message -----
> > From: "MANOJ SHARMA" <msharma@i...>
> > To: "professional vb" <pro_vb@p...>
> > Sent: Wednesday, August 28, 2002 12:01 AM
> > Subject: [pro_vb] RE: Program Freeze... Help Urgent!
> >
> >
> > > Hi,
> > >
> > > I will go with Matt's idea Sidney.... but will prefer to put DoEvents
> when
> > i
> > > am putting the lines in collection and also when processing the
> collection
> > > list.... what do you say Matt.. wouldn't this be little bit safe (at
> least
> > > user will not feel the program hanged while processing is going on...)?
> > >
> > > **************For Example*********************
> > > While Not mTSO.EOF
> > >     sBuffer = mTSO.ReadLine
> > >     mCol.add sBuffer
> > >     DoEvents
> > > Wend
> > > ***************************************************
> > >
> > > Regards,
> > >
> > > Manoj
> > >
> > > ----- Original Message -----
> > > From: "John Stendor" <john.stendor@c...>
> > > To: "professional vb" <pro_vb@p...>
> > > Sent: Tuesday, August 27, 2002 9:41 PM
> > > Subject: [pro_vb] RE: Program Freeze... Help Urgent!
> > >
> > >
> > > > Here is a quick fix for you.
> > > >
> > > > put this in a class and you should be fine.
> > > >
> > > > Option Explicit
> > > >
> > > > Private mFSO as FileSystemObject
> > > > Private mTSO as TextStream
> > > >
> > > > Private mCol as collection
> > > >
> > > > Public Function GetFullName(byVal vAcctNo) as String
> > > >
> > > > Dim ii         As integer
> > > > Dim sStream    As String
> > > > Dim sBuffer    As string
> > > > Dim FirstName  As String
> > > > Dim Lastname   As String
> > > > Dim MiddleName As String
> > > >
> > > >    ' Read the MASTER FILE file only once
> > > >
> > > >    If mCol.Count = 0 then
> > > >
> > > >       Set mFSO = New FileSystemObject
> > > >       Set mTSO = mFSO.OpenTextFile(gMasterList,ForReading)
> > > >
> > > >       While Not mTSO.EOF
> > > > sBuffer = mTSO.ReadLine
> > > > mCol.add sBuffer
> > > >       Wend
> > > >
> > > >       mTSO.Close
> > > >      set mTSO = Nothing
> > > >
> > > >    End If
> > > >
> > > >    For ii = 1 to mCol.Count - 1
> > > >       If Left$(mCol.Item(ii),12) = vAcctNO then
> > > > LastName = Mid$(mCol.Item(ii),13,30)
> > > >          Firstname = Mid$(mCol.Item(ii),43,40)
> > > >          MiddleName = Mid$(mCol.Item(ii),73,30)
> > > >          Exit For
> > > >       End if
> > > >    Next
> > > >
> > > >    GetFullName = LastName & ", " & FirstName & " " & MiddleName
> > > >
> > > > End Function
> > > >
> > > >
> > > > Matt Morgan wrote:
> > > > >
> > > > > Sidney - (and anyone else out there who may know);
> > > > >
> > > > > One other thing -
> > > > >
> > > > > Are you sure you can put 1MB into a string data type? I tried to do
> it
> > > in a test program; it locked up my VB session pretty quickly.
> > > > >
> > > > > Matt
> > > > >
> > > > > -----Original Message-----
> > > > > From: Matt Morgan
> > > > > Sent: Tuesday, August 27, 2002 9:18 AM
> > > > > To: 'professional vb'
> > > > > Subject: RE: [pro_vb] Program Freeze... Help Urgent!
> > > > >
> > > > > Sidney -
> > > > >
> > > > > It's been a long time since I worked with flat files, and even then
> > only
> > > in C, never VB.
> > > > >
> > > > > Anyway:
> > > > >
> > > > > 1) It looks like the call to fso.getfile is taking GMasterList as
> the
> > > file name argument. I don't see the file name declared anywhere, are you
> > > sure it's valid?
> > > > >
> > > > > 2) In C, with stream type files, you had to declare the number of
> > bytes
> > > to read, or use a different call to deal with CR delimited records. I'm
> > not
> > > sure how your files are laid out. I guess my question is, how does VB
> know
> > > how much to read before returning? I'm guessing that it's supposed to
> read
> > 1
> > > "Scripting.FileSystemObject", are you sure that this object accurately
> > > reflects the data in the file?
> > > > >
> > > > > Well, those are my only suggestions, and probably worthless. Good
> > luck!
> > > > >
> > > > > Matt
> > > > >
> > > > > -----Original Message-----
> > > > > From: Sidney Fuerte [mailto:fuertsj1104@y...]
> > > > > Sent: Monday, August 26, 2002 5:13 PM
> > > > > To: professional vb
> > > > > Subject: [pro_vb] Program Freeze... Help Urgent!
> > > > >
> > > > > Hi all,
> > > > >
> > > > > what's wrong with this code:
> > > > >
> > > > > Function GetFullName(gAcctNo)
> > > > > Dim fso As New FileSystemObject
> > > > > Dim f As File
> > > > > Dim ts As TextStream
> > > > > Dim sStream As String
> > > > > Dim nPos As Long
> > > > > Set fso = CreateObject("Scripting.FileSystemObject")
> > > > > Set f = fso.GetFile(gMasterList)
> > > > > Set ts = f.OpenAsTextStream(ForReading)
> > > > > sStream = ts.ReadAll
> > > > > nPos = InStr(1, sStream, gAcctNo)
> > > > > If nPos > 0 Then
> > > > >     gLastName = Mid(sStream, nPos + 12, 30)
> > > > >     gFirstName = Mid(sStream, nPos + 43, 30)
> > > > >     gMidName = Mid(sStream, nPos + 74, 30)
> > > > > End If
> > > > > End Function
> > > > >
> > > > > gMasterList is about 1 MB only its not that big, I am trying to do a
> > > > > search on this file, i dont want it line by line co'z it will take
> > long
> > > > > that's why I am reading it all... I debug my program and it freezes
> > from
> > > > > the ts.ReadAll line... any Idea why? do you have any idea to solve
> my
> > > > > search problem? please help me.
> > > > >
> > > > > Thanks/Regards
> > > > > Sidney
> > > > >
> > > > > ---
> > > > > Visual C# - A Guide for VB6 Developers
> > > > > This book will make it easy to transfer your skills
> > > > > from Visual Basic 6 to C#, the language of choice
> > > > > of the .NET Framework.
> > > > > http://www.wrox.com/ACON11.asp?ISBN=1861007175&p2p0059
> > > > >
> > > > >
> > > > > ---
> > > > > Visual C# - A Guide for VB6 Developers
> > > > > This book will make it easy to transfer your skills
> > > > > from Visual Basic 6 to C#, the language of choice
> > > > > of the .NET Framework.
> > > > > http://www.wrox.com/ACON11.asp?ISBN=1861007175&p2p0059
> > > > >
> > > >
> > > >
> > > > ---
> > > > Visual C# - A Guide for VB6 Developers
> > > > This book will make it easy to transfer your skills
> > > > from Visual Basic 6 to C#, the language of choice
> > > > of the .NET Framework.
> > > > http://www.wrox.com/ACON11.asp?ISBN=1861007175&p2p0059
> > > >
> > > >
> > >
> > >
> > >
> > > ---
> > > Visual C# - A Guide for VB6 Developers
> > > This book will make it easy to transfer your skills
> > > from Visual Basic 6 to C#, the language of choice
> > > of the .NET Framework.
> > > http://www.wrox.com/ACON11.asp?ISBN=1861007175&p2p0059
> > >
> >
> >
> >
> > ---
> > Visual C# - A Guide for VB6 Developers
> > This book will make it easy to transfer your skills
> > from Visual Basic 6 to C#, the language of choice
> > of the .NET Framework.
> > http://www.wrox.com/ACON11.asp?ISBN=1861007175&p2p0059
> >
> >
> 
> ---
> Visual C# - A Guide for VB6 Developers
> This book will make it easy to transfer your skills
> from Visual Basic 6 to C#, the language of choice
> of the .NET Framework.
> http://www.wrox.com/ACON11.asp?ISBN=1861007175&p2p0059
> 

  Return to Index