Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 97411
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T00:00:00+00:00 2026-05-11T00:00:00+00:00

I created a Winforms AutoComplete combobox control inheriting from ComboBox with the following method:

  • 0

I created a Winforms AutoComplete combobox control inheriting from ComboBox with the following method:

Protected Overrides Sub OnKeyPress(ByVal e As System.Windows.Forms.KeyPressEventArgs)         MyBase.OnKeyPress(e)         Dim text As String = Me.Text         If Char.IsLetter(e.KeyChar) Then             text = text + e.KeyChar         End If         If (text.Length = AutoCompleteSearchChars And Char.IsLetter(e.KeyChar)) Then             SetAutoCompleteMethod.Invoke(text)             Me.AutoCompleteSource = AutoCompleteSource.ListItems             Me.Text = text             Me.SelectionStart = text.Length             Me.SelectionLength = 0             If Me.Items.Count > 0 Then                 Me.SelectedIndex = 0             End If             e.Handled = True         End If     End Sub 

The ‘SetAutoCompleteMethod’ is a delegate pointing to a method that populates the combobox items based on using the current text in the combo box as the prefix for a wildcard search. This provides similar functionality to the ajax autocomplete combobox.

This all works fine the first time it is called, but the second time it is called I get the ‘Attempted to read or write protected memory. This is often an indication that other memory has been corrupted’ error. The error appears after all the code to update the combobox is completed. I get the following stack trace:

at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg) at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms. UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData) at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.Run(ApplicationContext context) at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.OnRun() at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.DoApplicationModel() at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(String[] commandLine) at ApplicationShell.My.MyApplication.Main(String[] Args) in 17d14f5c-a337-4978-8281-53493378c1071.vb:line 81 at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args) at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args) at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly() at System.Threading.ThreadHelper.ThreadStart_Context(Object state) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Threading.ThreadHelper.ThreadStart()

Is Anyone able to point me in the right direction to solve this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T00:00:00+00:00Added an answer on May 11, 2026 at 12:00 am

    When I’ve gotten that error, it turned out to really be an issue with dereferencing a null pointer, but it made the method call anyway and didn’t crash until it tried to access one of the member variables. I haven’t really worked with VB since before the days of .Net, but your stack trace suggests it died in a native call somewhere. If that’s the case, you might be running into the same issue in which case I’d recommend you double check those pointers, not just where it crashes, but a couple levels up too.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 112k
  • Answers 112k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Unless the developer of the flash widget implemented it with… May 11, 2026 at 9:54 pm
  • Editorial Team
    Editorial Team added an answer If you break down the HRESULT value, the facility code… May 11, 2026 at 9:54 pm
  • Editorial Team
    Editorial Team added an answer There are people making a living out of functional programming… May 11, 2026 at 9:54 pm

Related Questions

I created a pretty fancy winforms app for my company. We had a graphic
I'm using a winforms webbrowser control to display some content in a windows forms
I've created the default WCF Service in VS2008. It's called Service1 public class Service1
I've been trying to understand Process.MainWindowHandle . According to MSDN; The main window is

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.