locked
Close the form if the textbox hasn't validated RRS feed

  • Question

  • Hi,
    I am using Validating event to validate the textbox. All good and dandy. However, I would like the user to be able to close the form at any time.

    I was wondering if there is a way to do this since WndProc is not supported in NetCF? if someone could refer me to the clear instructions on how to achieve this under 2 hours of searching the web, that would be great!
    Thanks!
    Monday, June 16, 2008 7:10 PM

Answers

All replies

  • Hi

     

    You can PInvoke the required functionality. Look at the following examples:

     

    http://blogs.msdn.com/netcfteam/archive/2005/05/20/420551.aspx

    and

    http://blogs.msdn.com/netcfteam/archive/2005/05/23/421143.aspx

     

    Hope that helps

     

    Daniel

     

    Monday, June 16, 2008 7:21 PM
  • Thanks Daniel,

    from what I understand alternatively I can use
    IMessageFilter Interface

    as per
    http://www.opennetcf.com/library/sdf/html/ee58b3fb-88a7-722c-7a17-ee9829bd6728.htm

    Please clarify.
    Monday, June 16, 2008 8:08 PM
  • Hy

    Yes I think that would be the alternative. An example how to use the IMessageFilter you can find here:

     

    http://msdn.microsoft.com/de-de/library/system.windows.forms.application.addmessagefilter(VS.80).aspx

     

    The smart device library implementation works according to the MSDN article...

     

    Hope that helps

     

    Daniel

    Monday, June 16, 2008 8:11 PM
  • I am using this example:

    http://blog.opennetcf.com/ctacke/2007/05/07/SDFSampleGettingMouseUpAndMouseDownForControlsWithoutThoseEvents.aspx


    and I get the following error:


    'OpenNETCF.Windows.Forms.IMessageFilter' is not implemented by this class.   

    Am I missing something?

    I tried to comment and ask the author of the code, but the blog's commenting feature doesn't work.

    these are my includes:

    Imports OpenNETCF.Windows.Forms
    Imports OpenNETCF.Win32.WM
    Imports System.Diagnostics

    Imports System.Windows.Forms
    Imports OpenNETCF.WindowsCE



    Monday, June 16, 2008 9:03 PM
  • oh, i got it to work

    remind me once why i don't use VB, was a trivial syntax error, lol
    Monday, June 16, 2008 9:31 PM
  • Hy Big Smile

     

    Glad I could help Big Smile

     

    Daniel

    Tuesday, June 17, 2008 5:00 AM