CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Jul 2000
    Posts
    67

    VB and overflow error

    Hello

    I have a overflow problem using my VB program together with large data
    amounts.
    My program do read gets a txt file as inparameter, and splits it up line by
    line, and puts it out on a MqSeries queue. When the txt file is bigger then
    10 mb, i got the overflow message, and the program do end without
    completing.

    Some examples from the code.

    'splits the inparameter (filename-infile and queuename-inqueue and
    queuemanager)
    cmds = Split(Command, " ", -1)
    For i = 0 To UBound(cmds)
    infile = cmds(0)
    Inqueue = cmds(1)
    QueueManager = cmds(2)
    Debug.Print " Command "; i; " = "; cmds(i)
    Next i



    ' Connect to the default queue manager
    MQCONN "", gHcon, CompCode, Reason

    fraPut.cboAPIRC.AddItem "MQCONN: CompCode = " + Str(CompCode) + ",
    Reason Code = " + Str(Reason), 0
    fraPut.cboAPIRC.ListIndex = 0

    MQMD_DEFAULTS md
    md.Format = MQFMT_STRING

    MQPMO_DEFAULTS pmo

    ' Get message to be "put" from the Put text box
    Buflen = Len(fraPut.txtPut.Text)
    Buffer = fraPut.txtPut.Text
    MQPUT gHcon, gHobj, md, pmo, Buflen, Buffer, CompCode, Reason
    fraPut.cboAPIRC.AddItem "MQPUT: CompCode = " + Str(CompCode) + ", Reason
    Code = " + Str(Reason), 0
    fraPut.cboAPIRC.ListIndex = 0

    Counter = Counter + 1

    Do anyone have any ideas of other ways to do this, and avoid overflow?

    TK



  2. #2
    Join Date
    Jul 2000
    Location
    Milano, Italy
    Posts
    7,726

    Re: VB and overflow error

    Change i and counter to a long data type
    ie:
    search for:
    dim i as integer
    dim counter as integer

    and replace them with:
    dim i as long
    dim Counter as long

    Special thanks to Lothar "the Great" Haensler, Tom Archer, Chris Eastwood, TCartwright, Bruno Paris, Dr_Michael
    and all the other wonderful people who made and make Codeguru a great place.
    Come back soon, you Gurus.

    The Rater
    ...at present time, using mainly Net 4.0, Vs 2010



    Special thanks to Lothar "the Great" Haensler, Chris Eastwood , dr_Michael, ClearCode, Iouri and
    all the other wonderful people who made and make Codeguru a great place.
    Come back soon, you Gurus.

  3. #3
    Join Date
    Jul 2000
    Posts
    67

    Re: VB and overflow error

    Thank you Cimperiali. The answer made the day a lot better for me!


  4. #4
    Join Date
    Jul 2000
    Location
    Milano, Italy
    Posts
    7,726

    Re: you're welcome

    ;-)
    Have a nice day.


    Special thanks to Lothar "the Great" Haensler, Tom Archer, Chris Eastwood, TCartwright, Bruno Paris, Dr_Michael
    and all the other wonderful people who made and make Codeguru a great place.
    Come back soon, you Gurus.

    The Rater
    ...at present time, using mainly Net 4.0, Vs 2010



    Special thanks to Lothar "the Great" Haensler, Chris Eastwood , dr_Michael, ClearCode, Iouri and
    all the other wonderful people who made and make Codeguru a great place.
    Come back soon, you Gurus.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured