Results 1 to 23 of 23

Thread: [RESOLVED] Error Occurred

  1. #1

    Thread Starter
    Lively Member FYRe's Avatar
    Join Date
    Aug 2005
    Location
    Singapore
    Posts
    102

    Resolved [RESOLVED] Error Occurred

    An error occurred when I Run my form, what does the following error mean?

    (refer to screenshot)



    thks,
    FYRe
    Attached Images Attached Images  
    sOMEONE'S gONNA dO iT, wHY nOT yOU ?

  2. #2
    Frenzied Member mar_zim's Avatar
    Join Date
    Feb 2004
    Location
    Toledo Cebu City.
    Posts
    1,416

    Re: Error Occurred

    your trying to pass a value of string in datatype integer.

  3. #3
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    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 PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI 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

  4. #4
    Frenzied Member mar_zim's Avatar
    Join Date
    Feb 2004
    Location
    Toledo Cebu City.
    Posts
    1,416

    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.

  5. #5

    Thread Starter
    Lively Member FYRe's Avatar
    Join Date
    Aug 2005
    Location
    Singapore
    Posts
    102

    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 ?

  6. #6
    Frenzied Member mar_zim's Avatar
    Join Date
    Feb 2004
    Location
    Toledo Cebu City.
    Posts
    1,416

    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.

  7. #7
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    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 PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI 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

  8. #8

    Thread Starter
    Lively Member FYRe's Avatar
    Join Date
    Aug 2005
    Location
    Singapore
    Posts
    102

    Question 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
    Attached Images Attached Images   
    sOMEONE'S gONNA dO iT, wHY nOT yOU ?

  9. #9

    Thread Starter
    Lively Member FYRe's Avatar
    Join Date
    Aug 2005
    Location
    Singapore
    Posts
    102

    Re: Error Occurred

    oh man, why does the uploaded images does not show?
    sOMEONE'S gONNA dO iT, wHY nOT yOU ?

  10. #10
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    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 PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI 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

  11. #11
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    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:
    1. 'something like this...
    2. 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 PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI 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

  12. #12

    Thread Starter
    Lively Member FYRe's Avatar
    Join Date
    Aug 2005
    Location
    Singapore
    Posts
    102

    Re: Error Occurred

    hold on.... i'm checkin' it out...
    sOMEONE'S gONNA dO iT, wHY nOT yOU ?

  13. #13
    Frenzied Member mar_zim's Avatar
    Join Date
    Feb 2004
    Location
    Toledo Cebu City.
    Posts
    1,416

    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)

  14. #14

    Thread Starter
    Lively Member FYRe's Avatar
    Join Date
    Aug 2005
    Location
    Singapore
    Posts
    102

    Re: Error Occurred

    Quote 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:
    1. 'something like this...
    2. intPos = InStrRev(strBuff, "-") + 1
    So, do I replace all my IntStr to InStrRev ?
    sOMEONE'S gONNA dO iT, wHY nOT yOU ?

  15. #15

    Thread Starter
    Lively Member FYRe's Avatar
    Join Date
    Aug 2005
    Location
    Singapore
    Posts
    102

    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 ?

  16. #16
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    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 PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI 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

  17. #17
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: Error Occurred

    How about something like:
    VB Code:
    1. Dim fileName As String = "C:\Documents and Settings\user\Desktop\033227D - Pattern Matching\ATTOS chips\chips-005.bmp
    2.  
    3. fileName = IO.Path.GetFileNameWithoutExtension(fileName)
    4.  
    5. Dim fileNumber As Integer = Integer.Parse(fileName.Substring(fileName.LastIndexOf("-"c) + 1))
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  18. #18
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    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 PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI 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

  19. #19

    Thread Starter
    Lively Member FYRe's Avatar
    Join Date
    Aug 2005
    Location
    Singapore
    Posts
    102

    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 ?

  20. #20
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: Error Occurred

    I'd suggest you use a Private, class-level variable and a Public ReadOnly property that returns that variable:
    VB Code:
    1. Private m_MatchesFound As Integer
    2.  
    3. Public ReadOnly Property MatchesFound() As Integer
    4.     Get
    5.         Return Me.m_MatchesFound
    6.     End Get
    7. End Property
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  21. #21

    Thread Starter
    Lively Member FYRe's Avatar
    Join Date
    Aug 2005
    Location
    Singapore
    Posts
    102

    Re: Error Occurred

    Jm, do I have to declare m_MatchesFound in both forms?
    sOMEONE'S gONNA dO iT, wHY nOT yOU ?

  22. #22

    Thread Starter
    Lively Member FYRe's Avatar
    Join Date
    Aug 2005
    Location
    Singapore
    Posts
    102

    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 ?

  23. #23
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: Error Occurred

    Quote 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.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

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