Re: Customized IntegerTextBox problem

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Jeremy Todd (jhtodd_at_uiuc.edu)
Date: 04/15/04


Date: Thu, 15 Apr 2004 17:20:41 -0500


"Christian Soltenborn" <no_spam_csoltenborn@web.de> wrote in message
news:c5mgiq$3d1lt$1@ID-36219.news.uni-berlin.de...

> For this, I have two questions:
> a) If I override onTextChanged(), the method is called for every char
> entered. This would actually work for integers, but not for more complex
> data like a TimeSpan. Therefore I would like to override a method which
> is called if the complete data is entered (e.g. if the text box looses
> focus). Is there a way to do this?

    Overriding OnValidating or OnValidated sounds like what you want.
OnValidating is most likely better, since it gives you the option of
stopping the control from losing focus if the input is invalid.

    Also, be sure to call the base class method somewhere in there. In your
code, I notice there is no call to MyBase.OnTextChanged(e) in there
anywhere.

> b) I also could not figure out how I can give the focus back to my
> object after displaying the MessageBox. I didn't see anything like
> Me.SetFocus(), I can just ask if I have focus.

    Me.Focus = True

    My gut reaction is also that setting the focus should be a method and
not a property, but what can you do?

    Jeremy



Relevant Pages

  • Re: Inherited explained
    ... Justus J. wrote: ... procedure DoSomething; override; ... procedure SomethingElse(C: Char); ... us in a continuous stampede of patriotic fervor - with the cry ...
    (comp.lang.pascal.delphi.misc)
  • Re: Iterating over a String
    ... for (char category: categories) ... public static void main{ ...
    (comp.lang.java.help)
  • How can I override Memo field size default to make it larger??
    ... How can I override the 'Memo' field size 255 char default ... to the 65,535 char that the MS Access Help says it can ...
    (microsoft.public.access.gettingstarted)
  • Re: DateTimePicker and visibility to Min/Max Dates.
    ... Okay so what you want to do with the invalid dates is to make them ... There must be a way to override the rendering, but I don't see how now. ...
    (microsoft.public.dotnet.languages.csharp)
  • Problems with "Content Advisor"
    ... Anyone know how to override the content advisor ratings ... under Internet Options. ... informs me that it's invalid? ...
    (microsoft.public.win2000.security)