[dba-VB] c# text box changed event

Gustav Brock Gustav at cactus.dk
Tue Sep 29 05:04:51 CDT 2009


Hi John

Are we allowed to help with homework? Some forums explicitly prohibits this! The idea behind homework - ask your teacher - is quite often that you are supposed to work out a solution by yourself as a challenge for your - eh - limited resources!

Anyway, I had the same issue and worked out this very simple method:

<code>
        private void textBoxName_TextChanged(object sender, EventArgs e)
        {
            TextBox textBox = (TextBox)sender;
            if (textBox.Focused)
            {
                Console.WriteLine(textbox.Text);
            }
        }
</code>

/gustav


>>> jwcolby at colbyconsulting.com 29-09-2009 04:26 >>>
No.  I am doing a homework assignment where I collect grades in classes, and then move back and 
forth through the classes.  I have chosen to use a shared text box where the grade classes display 
their grades, and the user enters new grades.

John W. Colby
www.ColbyConsulting.com 


Michael Maddison wrote:
> Hi John,
> 
> Is the control bound?
> 
> Cheers
> 
> Michael M
> 
> -----Original Message-----
> From: dba-vb-bounces at databaseadvisors.com 
> [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of jwcolby
> Sent: Tuesday, 29 September 2009 12:05 PM
> To: VBA
> Subject: [dba-VB] c# text box changed event
> 
> I am setting the text in a text box via code which is causing the TextChanged event to fire.  I want 
> the event to fire for a manual edit so I can set a dirty flag, but not for changing the data by 
> code.  Is there a change event that fires for manual editing but not by code editing?






More information about the dba-VB mailing list