Overflow Error - Please Help 
Author Message
 Overflow Error - Please Help

An overflow error is caused when a number is larger than a variable can hold.
In your case it is probably the "position" variable that is defined as an
Integer.  This can hold a number up to  +32,767 to - 32,768.  Dim this as a Long
which can have the values from
-2,147,483,648 to 2,147,483,647.
The rich textbox may also have a size limt which you could be exceeding.  After
checking VB help I see that the RichTextBox is only limited to your PC's memory.
Quote:

> Hi all,

> Can anyone help me? I have a search box for a rich textbox control
> in a MDI app it works fine on smaller files but if I scan larger files I get
> a over flow error I think its something to do with the way the variables
> are defined can any one help. I have included the source below
> remember I call this sub with something like :

> Private Sub cmdFind_Click()

> find 1

> End Sub

> ' heres the guts

> Private Sub find(ByVal start_at As Integer)
> Dim position As Integer
> Dim thetext As String

> thetext = LCase(frmFind.Text1.Text) ' convert find sting to lower case
> richtext = LCase(frmDocument.txttext.Text) ' convert rich text box to lower
> case
> position = InStr(start_at, richtext, thetext) ' start at argument

> If position > 0 Then
> target = position
> frmDocument.txttext.SelStart = target - 1
> frmDocument.txttext.SelLength = Len(thetext)
> frmDocument.SetFocus
> Else
> errormsg = MsgBox("End of Document", vbOKOnly + vbInformation, "End of
> Document")
> frmFind.Text1.SelStart = 0
> frmFind.Text1.SelLength = Len(Text1.Text)
> frmFind.Text1.SetFocus
> End If

> End Sub

> Please help,

> Thanks in advance,

> Ryan Healey




Tue, 02 Oct 2001 03:00:00 GMT  
 Overflow Error - Please Help
Ryan,

I have a pretty good guess that the large files have in excess of 32000
characters. An integer will only hold up to 32000 or so and down to -32000 I
forget the exact number but I have made the same error.Change your code to:

Dim position as Long.

Good Luck

JT

Quote:

> Hi all,

> Can anyone help me? I have a search box for a rich textbox control
> in a MDI app it works fine on smaller files but if I scan larger files I get
> a over flow error I think its something to do with the way the variables
> are defined can any one help. I have included the source below
> remember I call this sub with something like :

> Private Sub cmdFind_Click()

> find 1

> End Sub

> ' heres the guts

> Private Sub find(ByVal start_at As Integer)
> Dim position As Integer
> Dim thetext As String

> thetext = LCase(frmFind.Text1.Text) ' convert find sting to lower case
> richtext = LCase(frmDocument.txttext.Text) ' convert rich text box to lower
> case
> position = InStr(start_at, richtext, thetext) ' start at argument

> If position > 0 Then
> target = position
> frmDocument.txttext.SelStart = target - 1
> frmDocument.txttext.SelLength = Len(thetext)
> frmDocument.SetFocus
> Else
> errormsg = MsgBox("End of Document", vbOKOnly + vbInformation, "End of
> Document")
> frmFind.Text1.SelStart = 0
> frmFind.Text1.SelLength = Len(Text1.Text)
> frmFind.Text1.SetFocus
> End If

> End Sub

> Please help,

> Thanks in advance,

> Ryan Healey




Tue, 02 Oct 2001 03:00:00 GMT  
 Overflow Error - Please Help
Hi all,

Can anyone help me? I have a search box for a rich textbox control
in a MDI app it works fine on smaller files but if I scan larger files I get
a over flow error I think its something to do with the way the variables
are defined can any one help. I have included the source below
remember I call this sub with something like :

Private Sub cmdFind_Click()

find 1

End Sub

' heres the guts

Private Sub find(ByVal start_at As Integer)
Dim position As Integer
Dim thetext As String

thetext = LCase(frmFind.Text1.Text) ' convert find sting to lower case
richtext = LCase(frmDocument.txttext.Text) ' convert rich text box to lower
case
position = InStr(start_at, richtext, thetext) ' start at argument

If position > 0 Then
target = position
frmDocument.txttext.SelStart = target - 1
frmDocument.txttext.SelLength = Len(thetext)
frmDocument.SetFocus
Else
errormsg = MsgBox("End of Document", vbOKOnly + vbInformation, "End of
Document")
frmFind.Text1.SelStart = 0
frmFind.Text1.SelLength = Len(Text1.Text)
frmFind.Text1.SetFocus
End If

End Sub

Please help,

Thanks in advance,

Ryan Healey



Wed, 03 Oct 2001 03:00:00 GMT  
 Overflow Error - Please Help
A long will hold 4 bytes (-2,147,483,648 to 2,147,483,647)

--
Kit Smith

ASP, VB, Javascript, HTML, RDB, ECommerce, Flash3, VBScript

Quote:

> Ryan,

> I have a pretty good guess that the large files have in excess of 32000
> characters. An integer will only hold up to 32000 or so and down to -32000
I
> forget the exact number but I have made the same error.Change your code
to:

> Dim position as Long.

> Good Luck

> JT


> > Hi all,

> > Can anyone help me? I have a search box for a rich textbox control
> > in a MDI app it works fine on smaller files but if I scan larger files I
get
> > a over flow error I think its something to do with the way the variables
> > are defined can any one help. I have included the source below
> > remember I call this sub with something like :

> > Private Sub cmdFind_Click()

> > find 1

> > End Sub

> > ' heres the guts

> > Private Sub find(ByVal start_at As Integer)
> > Dim position As Integer
> > Dim thetext As String

> > thetext = LCase(frmFind.Text1.Text) ' convert find sting to lower case
> > richtext = LCase(frmDocument.txttext.Text) ' convert rich text box to
lower
> > case
> > position = InStr(start_at, richtext, thetext) ' start at argument

> > If position > 0 Then
> > target = position
> > frmDocument.txttext.SelStart = target - 1
> > frmDocument.txttext.SelLength = Len(thetext)
> > frmDocument.SetFocus
> > Else
> > errormsg = MsgBox("End of Document", vbOKOnly + vbInformation, "End of
> > Document")
> > frmFind.Text1.SelStart = 0
> > frmFind.Text1.SelLength = Len(Text1.Text)
> > frmFind.Text1.SetFocus
> > End If

> > End Sub

> > Please help,

> > Thanks in advance,

> > Ryan Healey




Wed, 03 Oct 2001 03:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Overflow Error - Please Help

2. Overflow error - PLEASE HELP

3. Overflow Error - Please Help

4. Please help - overflow error using Access 97 database

5. ;Overflow (Error 6); !!!Can Anyone help me please

6. Please help - overflow error using Access 97 database

7. Overflow Error on Script!! Help Please

8. please help w/ overflow error on ADO connection.

9. Please Help: Scrollbar Max Value is giving Overflow error

10. Please help - overflow error using Access 97 database

11. PLEASE HELP, PLEASE HELP, PLEASE HELP, PLEASE HELP, PLEASE HELP, PLEASE HELP, PLEASE HELP,

12. Please help: Numeric field overflow

 

 
Powered by phpBB® Forum Software