|
-
Feb 22nd, 2006, 03:36 PM
#1
Thread Starter
Fanatic Member
[RESOLVED] Subscript out of range
Hey all,
I'm trying to set a cell of an array of booleans to true. But it gives me the subscript out or range error.
VB Code:
PassArr(lstFile.ListIndex) = True
(lstfile.listIndex = 0 - 43)
Is the code I'm trying to use to get the cell change to true.
and in the form load section I put this
VB Code:
ReDim Preserve PassArr(lstFile.ListCount)
(lstFile = 43)
So I'm not sure why it gives me this error. What is the problem?
-
Feb 22nd, 2006, 03:42 PM
#2
Re: Subscript out of range
If lstFile has no selection then the lstFile.ListIndex will be -1 throwing the error 9 error.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Feb 22nd, 2006, 03:47 PM
#3
Thread Starter
Fanatic Member
Re: Subscript out of range
lstFile was selected and I debugged then put my cursor over lstFile to show it's value
-
Feb 22nd, 2006, 03:48 PM
#4
Re: Subscript out of range
Ok, in that procedure with it in break mode, do a UBound(PassArr) in the immediate window and see what its dimensioned to.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Feb 22nd, 2006, 03:52 PM
#5
Thread Starter
Fanatic Member
Re: Subscript out of range
Ah! It was zero. I figured it out, I was dimensioning the array before setting the contents into the list box.
Thanks for helping Rob.
-
Feb 22nd, 2006, 03:58 PM
#6
Re: [RESOLVED] Subscript out of range
No prob. 
I thought it was something with the arr not being dimmed to the correct size.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|