Solved

Run time error 381

Posted on 2002-04-17
7
1,355 Views
Last Modified: 2008-03-03
An application developed in VB6 runs perfect in Windows NT, Win2k, win98. But gives error "run-time error '381' - Invalid array index". when run on Windows XP Please suggest.
0
Comment
Question by:sureshrao72
7 Comments
 
LVL 7

Expert Comment

by:Joe_Griffith
ID: 6948850
Your going to have to give more information to get an answer.  Can you post the code that is causing the problem?
0
 
LVL 16

Expert Comment

by:Richie_Simonetti
ID: 6948975
It appears like a problem with option base (0 or 1) but we need more details as joe saids.
0
 
LVL 100

Expert Comment

by:mlmcc
ID: 6949093
listening
0
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 

Author Comment

by:sureshrao72
ID: 6949171
The Vb code is

Private Sub cboMdlSlsAreaCd_DropDown()
    MousePointer = Default      '041702
    SendKeys "{DOWN}", True
End Sub

The error occurs when definiting the Dropdownbox cboMdlSlsArea_Cd.
0
 

Author Comment

by:sureshrao72
ID: 6949174
Forgot to mention. This happens only at run-time. This does'nt occur at design-time or debugg time.
0
 
LVL 3

Accepted Solution

by:
dannic earned 50 total points
ID: 6949248
You can try to add linenumbers and errorhandler to your code!

Eg.
Private Sub cboMdlSlsAreaCd_DropDown()
   On Error GoTo cboMdlSlsAreaCd_DropDownErr
10
   MousePointer = Default      '041702
20
   SendKeys "{DOWN}", True
30
   Exit Sub
cboMdlSlsAreaCd_DropDownErr:
    Call App.LogEvent("ErrorNumber: " & Err.Number & vbCrLf & _
                       "ErrorSource: " & Err.Source & vbCrLf & _
                       "ErrorDescription: " & Err.Description & vbCrLf & _
                       "Error at line: " & Erl, vbLogEventTypeError)
'Raise error
Err.Raise Err.Number, Err.Source, Err.Description
End Sub

This will help you to locate the statement that make this runtime error.

To see the log you just have to look in the Application log with the Event Viewer.
(Start->Programs->Administrative Tools->Event Viewer)

Good luck
dannic

0
 
LVL 15

Expert Comment

by:ameba
ID: 6949311
In Click event of cboMdlSlsAreaCd you are using its ListIndex property without checking if anything is selected.  Am I right?
If yes, include line "If cboMdlSlsAreaCd.ListIndex > -1 Then" before the line which uses ListIndex.  
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Specify ip address in my connection string for sas 2 65
Excel - Save a copy of work book 13 88
Protecting vb6 & .Net code Obfuscation 18 150
IF ELSE Statement in Excel Macro VBA 16 75
Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

791 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question