Puzzling C# Application Crash

Posted on 2009-02-24
Medium Priority
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
  • 2
LVL 12

Expert Comment

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

Pure speculation,  maybe put in some trace statements
LVL 15

Accepted Solution

angus_young_acdc earned 375 total points
ID: 23724509
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.

Author Comment

ID: 23724675
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


Author Closing Comment

ID: 31550663

Featured Post

Prep for the ITIL® Foundation Certification Exam

December’s Course of the Month is now available! Enroll to learn ITIL® Foundation best practices for delivering IT services effectively and efficiently.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Stellar Exchange Toolkit: this 5 in 1 toolkit comes loaded with mega-software tool. Here’s an introduction to tools’ usage and advantages:
Today as you open your Outlook, you witness an error message: “Outlook is using an old copy of your Outlook Data File…”. Probably, Outlook is accessing an old OST file.
Viewers will learn how to use the Hootsuite Dashboard.
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…
Suggested Courses

809 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