Results 1 to 10 of 10

Thread: vb.net published program crashes when drawing into picturebox

  1. #1

    Thread Starter
    New Member
    Join Date
    Apr 2025
    Posts
    5

    vb.net published program crashes when drawing into picturebox

    Hello,

    I'm new here and not a pro, that's why i have to ask the professionals. I made a very simple program for my cousin, which has some textboxes to fill out and
    doing some calculations with these inputs. After that you can click a button to draw lines into a picturebox, using the calculated and inserted numbers. In Visual Studio everything is fine,
    working without any problems. I published the program, created a setup.exe (had to convert to .net 6.0 first) and let him install it. Now everytime he clicks the button to draw into the picturebox, the program crashes. His operating system is Windows 10 pro. I tried it on a different pc, and it worked without any problem. Maybe someone can help me with this, couldn't find any answer on google or anywhere else.
    I think it's a problem with Windows 10 pro, but I'm not sure. Thanks in advance.

    Thomas

  2. #2
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    25,978

    Re: vb.net published program crashes when drawing into picturebox

    It almost definitely isn't a problem with Windows 10 pro.
    Did you both use the same input? Could be a .Net Core incompatibility

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

    Re: vb.net published program crashes when drawing into picturebox

    A crash in an unhandled exception. You need to get the data from that exception because it tells you what the problem is. Windows should provide the information but you can also write code to catch the exception and log the information yourself. Do that and tell us what you find. You should also show us the relevant code. We may know more than you but we still need information to diagnose the issue.
    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

  4. #4

    Thread Starter
    New Member
    Join Date
    Apr 2025
    Posts
    5

    Re: vb.net published program crashes when drawing into picturebox

    ok, thank You for Your answers. So how can I log whats happening. Just let print into a textfile on the computer in the try catch end try loop? But what do i have to write in that code, so that the problem is written down?
    Then release/publish again and let him try, right?

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

    Re: vb.net published program crashes when drawing into picturebox

    You may not have to do anything. Usually, if an app crashes, Windows displays a dialogue with a Details button. For .NET apps, that will generally include the exception details. You can just get the user to copy that and provide it to you however is convenient.

    As for catching the exception, unless it's something you can reasonable expect to happen, don't catch it explicitly. Add code to handle the UnhandledException event of the application, which you should always be doing anyway. You can then log the exception and shut down cleanly. It's up to you how to log it. You might just display it in a message box and have the user copy it and send it to you. It's completely up to you what's appropriate.
    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

  6. #6

    Thread Starter
    New Member
    Join Date
    Apr 2025
    Posts
    5

    Re: vb.net published program crashes when drawing into picturebox

    ok, the problem is, there is no Windows dialogue. The program just closes without any error message. i browsed a little bit, and i think this code would do the job, am i right?


    ```
    Code:
    Catch ex As Exception
                    MsgBox(ex.Message)
                    My.Application.Log.WriteException(ex, TraceEventType.Error, "Exception " & "with argument " & "C:\Log.txt" & ".")
    End Try

  7. #7
    Super Moderator dday9's Avatar
    Join Date
    Mar 2011
    Location
    South Louisiana
    Posts
    12,084

    Re: vb.net published program crashes when drawing into picturebox

    That is one way, yes. It might already be logged in the event viewer too, I would suggest checking there first.
    "Code is like humor. When you have to explain it, it is bad." - Cory House
    VbLessons | Code Tags | Sword of Fury - Jameram

  8. #8

    Thread Starter
    New Member
    Join Date
    Apr 2025
    Posts
    5

    Re: vb.net published program crashes when drawing into picturebox

    ok, the event viewer recorded the crash, that information is inside (some parts in german). But how can i read it. Looks like a dll problem?
    System
    - Provider
    [ Name] Windows Error Reporting
    - EventID 1001
    [ Qualifiers] 0
    Version 0
    Level 4
    Task 0
    Opcode 0
    Keywords 0x80000000000000
    - TimeCreated
    [ SystemTime] 2025-04-15T05:01:22.2090579Z
    EventRecordID 282649
    Correlation
    - Execution
    [ ProcessID] 0
    [ ThreadID] 0
    Channel Application
    Computer Sonnenschutzdoktor
    Security
    - EventData
    2245480069158270704
    4
    APPCRASH
    Nicht verfügbar
    0
    Sonnenschutzdoktor Berechnungsapp.exe
    0.0.0.0
    670d0000
    KERNELBASE.dll
    10.0.19041.5678
    024a42e4
    c000041d
    000000000003b699
    \\?\C:\ProgramData\Microsoft\Windows\WER\Temp\WER8A31.tmp.WERInternalMetadata.xml

    ?
    \\?\C:\ProgramData\Microsoft\Windows\WER\ReportArchive\AppCrash_Sonnenschutzdokt_c9ebb2d72221db35458 bc2f664993ba8efa29d1f_588a3b03_d3e4afc5-68f8-42ad-9e85-a9151634de8c
    0
    23dbe9a5-5192-4210-b5f8-24de1f6bbe5d
    268435456
    c55d980e4e9de446bf298c39d065f6f0
    Last edited by jmcilhinney; Apr 15th, 2025 at 01:57 AM.

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

    Re: vb.net published program crashes when drawing into picturebox

    There's no exception data there. How about you do what I suggested - what I suggested you should already be doing because it should be done in every app that supports it - and handle the UnhandledException event of the application?
    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

  10. #10

    Thread Starter
    New Member
    Join Date
    Apr 2025
    Posts
    5

    Re: vb.net published program crashes when drawing into picturebox

    ok, i try to implement a code to get the exception data from the program itself. I share the information as soon as i get it.

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