Sep 13th, 2005, 08:29 PM
#1
Thread Starter
Lively Member
[RESOLVED] Error Occurred
An error occurred when I Run my form, what does the following error mean?
(refer to screenshot)
thks,
FYRe
Attached Images
sOMEONE'S gONNA dO iT, wHY nOT yOU ?
Sep 13th, 2005, 08:38 PM
#2
Re: Error Occurred
your trying to pass a value of string in datatype integer.
Sep 13th, 2005, 08:45 PM
#3
Re: Error Occurred
Post the code and well help you convert it.
Edit: Congrats Mar_Zim on 1,000 posts! You should mark this post so you can refer back to it in the years to come
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
Sep 13th, 2005, 08:56 PM
#4
Re: Error Occurred
Well thanks guys and congrats robdog888 of your new power. I've heard rumors that some mod's got jealous because of your status.
Sep 13th, 2005, 08:59 PM
#5
Thread Starter
Lively Member
Re: Error Occurred
abt posting the codes... i guess not, it's very long & messy. Maybe I'll just send a screenshot. Will that do?
sOMEONE'S gONNA dO iT, wHY nOT yOU ?
Sep 13th, 2005, 09:04 PM
#6
Re: Error Occurred
Just post the line that you pass the value "Pa" or toggle then post the code on where it throws an exception.
Sep 13th, 2005, 09:04 PM
#7
Re: Error Occurred
Find the code where it shows the "PA" and post those lines and that should help. you could also just step through your code by pressing F11 (default) or F8 if you set it as the VB6 classic IDE interface. Then you can step and find the exact line of offensive code.
Thanks for the congrats mar_zim and I dont think there were any issues with it. Everything is running smooth as could be.
Ps, by tomorrow night I should hit 18K posts
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
Sep 13th, 2005, 09:11 PM
#8
Thread Starter
Lively Member
Re: Error Occurred
Ok, my form contain this browse button, so when user clicks on it, it opens an OpenFileDialog.
" Extract_Number " extracts the digits of a particular filename.
For example if I have the following as my filename:
" C:\Documents and Settings\user\Desktop\033227D - Pattern Matching\ATTOS chips\chips-005.bmp ",
it will extract the number 5 from 005.
so,
if 006, extracts 6
if 007, extracts 7
if 008, extracts 8
if 009, extracts 9
if 010, extracts 10
etc.....
however, when I Run my form, the error occured as shown in screenshot.
thks,
FYRe
sOMEONE'S gONNA dO iT, wHY nOT yOU ?
Sep 13th, 2005, 09:12 PM
#9
Thread Starter
Lively Member
Re: Error Occurred
oh man, why does the uploaded images does not show?
sOMEONE'S gONNA dO iT, wHY nOT yOU ?
Sep 13th, 2005, 09:14 PM
#10
Re: Error Occurred
The error is because your parsing on the first dash "- Pattern Matching\ATTOS chips\chips- 005.bmp" and thats giving you a return of "Pa".
You have 2 instances of the dash.
If you attach 2 or more images the image shows as a link. Just click on the link file.
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
Sep 13th, 2005, 09:19 PM
#11
Re: Error Occurred
You could use instrrev instead so you start your search for the dash from the end (right side to left side) and catch the last occurance of the dash.
VB Code:
'something like this...
intPos = InStrRev(strBuff, "-") + 1
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
Sep 13th, 2005, 09:20 PM
#12
Thread Starter
Lively Member
Re: Error Occurred
hold on.... i'm checkin' it out...
sOMEONE'S gONNA dO iT, wHY nOT yOU ?
Sep 13th, 2005, 09:20 PM
#13
Re: Error Occurred
As what I've understand the ImageNumber is an integer then the Extract_Number is a string then you assign the ImageNumber to the function string which is wrong.
Try to cast your function Extract_Number to int. ImageNumber=CInt(Extract_Number(OpenfileDialog1.FileName)
Sep 13th, 2005, 09:29 PM
#14
Thread Starter
Lively Member
Re: Error Occurred
Originally Posted by
RobDog888
You could use instrrev instead so you start your search for the dash from the end (right side to left side) and catch the last occurance of the dash.
VB Code:
'something like this...
intPos = InStrRev(strBuff, "-") + 1
So, do I replace all my IntStr to InStrRev ?
sOMEONE'S gONNA dO iT, wHY nOT yOU ?
Sep 13th, 2005, 09:31 PM
#15
Thread Starter
Lively Member
Re: Error Occurred
So, you're trying to say that InStrRev( ) , search for the dash from right-to-left,
and IntStr( ) search for the dash from left-to-right ?
sOMEONE'S gONNA dO iT, wHY nOT yOU ?
Sep 13th, 2005, 09:35 PM
#16
Re: Error Occurred
No, more like search for the dash from right to left and search for the dot from right to left. This will always give you the last occurance of the chars so if the filepath has those chars it wont interfere with your code parsing.
I'll see if I can come up with some .NET code for you.
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
Sep 13th, 2005, 09:39 PM
#17
Re: Error Occurred
How about something like:
VB Code:
Dim fileName As String = "C:\Documents and Settings\user\Desktop\033227D - Pattern Matching\ATTOS chips\chips-005.bmp
fileName = IO.Path.GetFileNameWithoutExtension(fileName)
Dim fileNumber As Integer = Integer.Parse(fileName.Substring(fileName.LastIndexOf("-"c) + 1))
Sep 13th, 2005, 09:45 PM
#18
Re: Error Occurred
I step away for a minute helping in another thread and wham! There it is.
Good job John.
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
Sep 13th, 2005, 09:51 PM
#19
Thread Starter
Lively Member
Re: Error Occurred
I want to declare an integer variable, "MatchesFound", and this integer variable contains an integer. I want the value to be able to use in my another form. What should I declare it as ?
Public ? Friend ?
sOMEONE'S gONNA dO iT, wHY nOT yOU ?
Sep 13th, 2005, 09:55 PM
#20
Re: Error Occurred
I'd suggest you use a Private, class-level variable and a Public ReadOnly property that returns that variable:
VB Code:
Private m_MatchesFound As Integer
Public ReadOnly Property MatchesFound() As Integer
Get
Return Me.m_MatchesFound
End Get
End Property
Sep 13th, 2005, 10:01 PM
#21
Thread Starter
Lively Member
Re: Error Occurred
Jm, do I have to declare m_MatchesFound in both forms?
sOMEONE'S gONNA dO iT, wHY nOT yOU ?
Sep 13th, 2005, 10:06 PM
#22
Thread Starter
Lively Member
Re: Error Occurred
I'll post this question in another thread... Anyway, thks for the solutions.
Last edited by FYRe; Sep 13th, 2005 at 10:09 PM .
sOMEONE'S gONNA dO iT, wHY nOT yOU ?
Sep 13th, 2005, 10:14 PM
#23
Re: Error Occurred
Originally Posted by
FYRe
Jm, do I have to declare m_MatchesFound in both forms?
m_MatchesFound is a variable private to the class it's being calculated in. You then access it's value from outside that class via the MatchesFound property.
Just one very small stylistic point. MatchesFound sounds like a boolean variable to me. If a variable is meant to be counting something then it's a good idea to reflect that in the name, e.g. MatchCount or NumMatches. Like I said, a very small point but I'm a bit uptight that way.
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