StrataFrame Forum

Browse Dialog and Searching Event

http://forum.strataframe.net/Topic10835.aspx

By Robin J Giltner - 8/13/2007

Is there a trick to having the Searching Event raised on a subclassed BrowseDialog?  I have several subclassed BD's and I can't seem to ever get the Searching Event to fire off.  In my one non-subclassed BD, the event gets raised fine and I can go about my business, but on my others it never seems to.

I've tried putting the event handler on the form the BD is on, as well as in the BD designer with no luck.  I'm pretty sure I'm missing something easy, but I can't for the life of me figure this one out.

Thanks

Robin Giltner

By Trent L. Taylor - 8/14/2007

Well, since you are subclassing the BD, just override the OnSearching method.  This will give you ultimate control and you can place your code before or after the event.

Protected Overrides Sub OnSearching(ByVal e As MicroFour.StrataFrame.UI.Windows.Forms.BrowseDialogSearchingEventArgs)
        MyBase.OnSearching(e)
        '-- Add your code
    End Sub
By Robin J Giltner - 8/14/2007

And here I can test the input on the search fields and strip out what shouldn't be there?  Users keep wanting to put text into a numeric field in the BrowseDialog.

Thanks

Robin Giltner

By Trent L. Taylor - 8/14/2007

Yeah, the OnSearching method is the method that is invoked to raise the Searching event.  So this is the same as handling the event, but you actually have more control.
By Robin J Giltner - 8/28/2007

Well, I've messed with this as long as I think I can before my head explodes.

I went back and made a simple project with one BusinessObject and one BrowseDialog to the Strataframe Sample, and added some code to the BrowseDialog1.Searching Event to see if I could get it to do something, with no luck.

I'm sure I am missing something here, but can't for the life of me figure this one out.

Any chance you could take a look and point me in the right direction?

Thanks

Robin Giltner

By Robin J Giltner - 8/28/2007

Doh, yeah... think I have it.  There searching event is getting fired off, but only when the whereclause gets built without errors, as the clause has to be built before you can interact with the values inside it.  That only makes a huge amount of sense. Crazy

So it looks like I'll have to try something else to filter the search criteria the user puts into the searchfield.  It keeps failing trying to convert a string to a double on the BuildWhereElement clause.  I guess I can use the Mask property on the tetbox to limit input, and see how that goes.

Thanks

Robin Giltner

By StrataFrame Team - 8/29/2007

Aye, a mask on the input would be your best bet.