Drstein99 Posted October 16, 2003 Posted October 16, 2003 I'm using vb.net and I want to know if the textbox changed event is being executed from the user changing it or by another function. Because I have functions in the program to clear the text box, and it may be executing from that other function. I cant figure out these parameter/arguments the .net help is too vauge - please help, thanks Private Sub tbs_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tbSText.TextChanged Quote www.DRSTEIN99.com www.RAIDGEAR.net www.THERE.com -> Tell them DrStein99 sent ya!
*Experts* mutant Posted October 16, 2003 *Experts* Posted October 16, 2003 Yes, TextChanged event will fire if you change the text from code. Quote
Drstein99 Posted October 16, 2003 Author Posted October 16, 2003 Ok thanks for the info. I know that. I guess I didnt phrase my question correctly, please allow me to try again: HOW can I find out from the parameters if the event was activated by the user OR another function? Quote www.DRSTEIN99.com www.RAIDGEAR.net www.THERE.com -> Tell them DrStein99 sent ya!
JumpsInLava Posted October 16, 2003 Posted October 16, 2003 Do a: messagebox.show(sender.GetType.ToString) may be you can do somthing like: If sender.GetType.ToString = "stuff" Then 'this Else 'that End If Quote
Drstein99 Posted October 16, 2003 Author Posted October 16, 2003 It returns: systems.windows.forms.textbox Every time whether I'm updating the window through keypress or not. Quote www.DRSTEIN99.com www.RAIDGEAR.net www.THERE.com -> Tell them DrStein99 sent ya!
*Experts* Volte Posted October 16, 2003 *Experts* Posted October 16, 2003 You could try using the KeyPress event. You may have to handle special cases (for example, if I press the Enter key in a non-multiline textbox, KeyPress will still fire even if the text itself doesn't change) but it appears to be the only way to do it. Quote
Drstein99 Posted October 16, 2003 Author Posted October 16, 2003 Thats what I ended up doing. Thanks. Quote www.DRSTEIN99.com www.RAIDGEAR.net www.THERE.com -> Tell them DrStein99 sent ya!
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.