Click here to Skip to main content
15,895,746 members

TextChanged event works in VC# 2010 but not VC# 2005

Mordanthanus asked:

Open original thread
I was writing a small program in Visual C# 2010 to ultimately be loaded on a handheld scanner with WinCE 5. Works great in 2010.

Come to find out, I needed to use the 2005 version. So I copied my code over to 2005, and now the TextChanged event doesn't trigger. I have tried it in a regular Windows App in 2005 as well, with the same results. The data goes into the textbox just fine, but changing the text doesn't trigger the event.

I have a textBox with this code attached. I test it in Windows by just Ctrl-V the data into it and it would trigger fine. In 2010, works great, not in 2005. On the handheld, the scanner will put info in this box.

C#
private void textBox1_TextChanged(object sender, EventArgs e)
        {
            //only get scan if txtbox isnt empty
            if (textBox1.Text.Length > 0)
            {
                scanCode = ReadCode();
                //if scanCode == null that means it was a bad scan
                if (scanCode == null)
                {
                    button1.Text = "Wrong Barcode - Try Again";
                    button1.BackColor = System.Drawing.Color.Red;

                    //Log that someone scanned the wrong barcode
                    log.WriteLine(DateTime.Now);
                    log.WriteLine("Invalid Barcode scanned");
                    log.WriteLine("Code = " + scanCode);
                    log.WriteLine();
                    log.Flush();
                }
                else //else it was a good scan
                {
                    ProcessScan();
                }

            }
        }


Anyone know of any differences between the versions that would keep this from triggering? Any help is greatly appreciated.
Tags: C#

Plain Text
ASM
ASP
ASP.NET
BASIC
BAT
C#
C++
COBOL
CoffeeScript
CSS
Dart
dbase
F#
FORTRAN
HTML
Java
Javascript
Kotlin
Lua
MIDL
MSIL
ObjectiveC
Pascal
PERL
PHP
PowerShell
Python
Razor
Ruby
Scala
Shell
SLN
SQL
Swift
T4
Terminal
TypeScript
VB
VBScript
XML
YAML

Preview



When answering a question please:
  1. Read the question carefully.
  2. Understand that English isn't everyone's first language so be lenient of bad spelling and grammar.
  3. If a question is poorly phrased then either ask for clarification, ignore it, or edit the question and fix the problem. Insults are not welcome.
  4. Don't tell someone to read the manual. Chances are they have and don't get it. Provide an answer or move on to the next question.
Let's work to help developers, not make them feel stupid.
Please note that all posts will be submitted under the http://www.codeproject.com/info/cpol10.aspx.



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900