Results 1 to 7 of 7

Thread: error 381 Subscript out of range

  1. #1

    Thread Starter
    PowerPoster isnoend07's Avatar
    Join Date
    Feb 2007
    Posts
    3,237

    error 381 Subscript out of range

    I have a form with 6 edible mshflexgrids that stays loaded throughout the life of my app. It can only be unloaded when the main form unloads. The main form holds a public module level variable that is set to true when the main form is unloading. Then the main form unloads all forms in the app:
    Code:
     Dim frm As Form
       For Each frm In Forms
       Unload frm
       Set frm = Nothing
       Next
    The problem i am having is somehow the grids loose the amount of rows they are supposed to contain and i get the error 381 subscript out of range. Is their any way the mshflexgrids can loose the number of rows without unloading the form ?
    Waiting for a full featured smart phone with out marrying a provider
    Go Android
    Go raiders

  2. #2
    VB6, XHTML & CSS hobbyist Merri's Avatar
    Join Date
    Oct 2002
    Location
    Finland
    Posts
    6,654

    Re: error 381 Subscript out of range

    When do you get the error? Which lines of code and where?

  3. #3

    Thread Starter
    PowerPoster isnoend07's Avatar
    Join Date
    Feb 2007
    Posts
    3,237

    Re: error 381 Subscript out of range

    Quote Originally Posted by Merri View Post
    When do you get the error? Which lines of code and where?
    thanks for the reply. this has been an ongoing problem and only happens guessing about 1 in 75 installs. my app sends me thru an online jmail the error# form name, sub name and line number, win ver, app version etc. the grids hold prices that are all tied together and loaded from a file. In other words the total price grid holds the totals of labor,materials, roof removal, etc. changing any values updates the total price grid. I do not know at what point the error occurs or why. in my error reporting routine I added this to tell me how many rows each grid contained:
    the only grid with the correct number of rows is the GridFelts,
    GridLabor rows 1
    GridRoofRemoval rows 1
    GridMaterial rows 1
    gridProfit rows 1
    GridTotalPrice rows 1
    GridFelts rows 10
    the only grid with the correct number of rows is the GridFelts, the rest should at least be 8 rows. i just do not understand how the grids loose their rows. Unfortunately when i make corrections, changes i have to wait for many users to install my app and that could be a month.
    what i am thinking of adding is a routine to send me the number of rows on the form load right after the grids row,cols are set are filled with data, Hopefully before the error occures
    Waiting for a full featured smart phone with out marrying a provider
    Go Android
    Go raiders

  4. #4

    Thread Starter
    PowerPoster isnoend07's Avatar
    Join Date
    Feb 2007
    Posts
    3,237

    Re: error 381 Subscript out of range

    Btw, the error is not OS specific, had it happen on xp,vista and win 7
    The error report i receive by email:
    ==Software Details==
    Program Name : RoofCalcWriter (10.8.288)
    App ExeName : RoofCalcWriter
    App Path : C:\Program Files\RoofCalcWriter

    ==Computer Details==
    OS Name : Windows XP - Service Pack 3
    Processor Info: x86 Family 6 Model 8 Stepping 1, AuthenticAMD - Cores : 1
    Computer Date : 8/11/2010 10:23:56 AM
    Server Date : 8/11/2010 10:23:52 AM

    ==Error Details==
    Module Name : frmNewPricePerSq
    Function Name : Sub AddUpTotalPriceColumns
    Line Number : 50
    Error Number : 381
    Error Desc : Subscript out of range.

    Custom Message: Basic OS: Windows XP
    Edition : Service Pack 3
    Version Number: 5.1
    Build Number : 2600
    Product Name: Microsoft Windows XP
    gMyPath: C:\Documents and Settings\All Users\Documents\RoofCalcWriter\AppFolder
    Path To Program Files: C:\Program Files
    Is 64 Bit: False
    IsAdministrator: True
    GridLabor rows 1
    GridRoofRemoval rows 1
    GridMaterial rows 1
    gridProfit rows 1
    GridTotalPrice rows 1
    GridFelts rows 10

    The user is behind a router/firewall.
    Waiting for a full featured smart phone with out marrying a provider
    Go Android
    Go raiders

  5. #5
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,541

    Re: error 381 Subscript out of range

    Quote Originally Posted by isnoend07 View Post
    ...The problem i am having is somehow the grids loose the amount of rows they are supposed to contain and i get the error 381 subscript out of range....
    Are you making an assumption? How do you know how many rows were initially loaded? Maybe that is the problem, flexgrid failed to load the rows because file failed to load properly, corrupted, or something else. Maybe track the number of rows loaded from your file and include that in any error report for now? Just an idea.
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

  6. #6

    Thread Starter
    PowerPoster isnoend07's Avatar
    Join Date
    Feb 2007
    Posts
    3,237

    Re: error 381 Subscript out of range

    Quote Originally Posted by LaVolpe View Post
    Are you making an assumption? How do you know how many rows were initially loaded? Maybe that is the problem, flexgrid failed to load the rows because file failed to load properly, corrupted, or something else. Maybe track the number of rows loaded from your file and include that in any error report for now? Just an idea.
    Thanks
    The rows,cols are a fixed number, but you are correct in me assuming the data was loaded correctly. Good idea the file is created from a resource file if it does not exist and contains example data. Once saved it is no longer example data. I could also check the file size after the extraction and also get that info.
    Waiting for a full featured smart phone with out marrying a provider
    Go Android
    Go raiders

  7. #7

    Thread Starter
    PowerPoster isnoend07's Avatar
    Join Date
    Feb 2007
    Posts
    3,237

    Re: error 381 Subscript out of range

    this error may be computer-system specific, because i also got an error that has never occured before in an unrelated form file process:

    Module Name : ROOFBIDDER
    Function Name : Function Countit
    Line Number : 100
    Error Number : 62
    Error Desc : Input past end of file
    this is from the same PC as the 381 error
    Waiting for a full featured smart phone with out marrying a provider
    Go Android
    Go raiders

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