Puzzling C# Application Crash

Posted on 2009-02-24
Last Modified: 2013-12-17
I am building an application in C# using Visual Studio 2008. I wanted to add an AutoComplete feature to a Text Box. The Autocomplete data comes out of a Microsoft Access DB. The problem after I type a couple of characters the Application crashes completly. I try to Debug but its not debugging (is this because its C#?).  

I attached the code thats under the TextChanged event and the DB procedure is a pretty standard Select 10 records add to string array.

Anybody have any ideas?
private void textBox1_TextChanged(object sender, EventArgs e)


            String[] range = dlc.findAutoComplete(textBox1.Text);




Open in new window

Question by:seanmccully
    LVL 12

    Expert Comment

    Might be an infinite loop ... AddRange might cause TextChanged to be called

    Pure speculation,  maybe put in some trace statements
    LVL 15

    Accepted Solution

    Click Debug then Exceptions and tick all options.  If there is an error it will show on the exact line first.  That is one way to try and resolve this, or at least narrow it down.

    As for why this is happening, well it could be that your string[] is being overwhelmed with data.  Try setting it to null after ever textchanged event on the off chance it is not clearing the data.
    LVL 3

    Author Comment

    Angus you were rght about the data being overwhelmed or growing. But Ive corrected that with <see below> and it persists. But when I took your suggestion about the Debug.

    What was I was catching Null Array exceptions and this resulted in Passing an Array to AddRange() that contained Nulls. Doesnt sound that bad, but when I corrected it, the problem went away.


    Open in new window

    LVL 3

    Author Closing Comment


    Featured Post

    Looking for New Ways to Advertise?

    Engage with tech pros in our community with native advertising, as a Vendor Expert, and more.

    Join & Write a Comment

    I annotated my article on ransomware somewhat extensively, but I keep adding new references and wanted to put a link to the reference library.  Despite all the reference tools I have on hand, it was not easy to find a way to do this easily. I finall…
    Today companies are subjected to more-and-more data, and it won't stop any time soon.  But there are obvious opportunities for reducing data, particularly data duplicated among companies.
    The viewer will learn common shortcuts with easy ways to remember them. The viewer will then learn where to find all of the keyboard shortcuts, how to create/change them, and how to speed up their workflow.
    This video will demonstrate how to find the puppet warp tool from the edit menu and where to put the points to edit.

    754 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    17 Experts available now in Live!

    Get 1:1 Help Now