Memory access violation when writing a combobox in Visual Basic

Bob Zeidman 1 Reputation point
2024-05-26T21:41:11.0533333+00:00

I've had a program since 2004. I've been updating it since then. The GUI is in Visual Basic. Suddenly a statement that simply takes the text from one combobox and puts it in a second (invisible) combobox is giving me a memory access violation during debug. The code runs when a button is pushed. The dozen or so lines of code simply check that fields are filled in. This code hasn't changed since the last version last year, which ran fine. Here is the error:

Access violation error

Visual Studio
Visual Studio
A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.
4,821 questions
VB
VB
An object-oriented programming language developed by Microsoft that is implemented on the .NET Framework. Previously known as Visual Basic .NET.
2,642 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Jiachen Li-MSFT 28,076 Reputation points Microsoft Vendor
    2024-05-27T02:44:54.57+00:00

    Hi @Bob Zeidman ,

    Consider any recent updates to Visual Studio, .NET Framework, or other dependencies that could affect the behavior of your application.

    Add some check to ensure that FileType1 and FileType2 are not null before attempting to assign their properties.

    Best Regards.

    Jiachen Li


    If the answer is helpful, please click "Accept Answer" and upvote it.

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments