Using the lost focus is a risky event to use for validation routines. If not
done propery, you could end up with endless loops going from one control to
the others lost focus event. I would suggest using the API code that I put
in the other reply that I submitted.
--
Rick Delorme
Software Developer
C-Team Systems Inc.
Nepean, Ontario
http://www.cteam.ca
http://www.rickdelorme.com
"Liju Thomas" <LThomas@e...> wrote in message news:49109@p..._vb...
>
> Hi Rajesh,
> I got your point. Here is one work around. There may be better
solutions...
>
> Assume that your text box is Text1.
> Since the ToolBar doesnt have CauseValidation property you will not be
> able to do the validation in the Validate Event. Take that validation to
> the
> LostFocus Event as below.
>
> Private Sub Text1_LostFocus()
> If ValidationFails Then
> Text1.SetFocus
> End If
> End Sub
>
> Now one interesting thing I found with Toolbar is , if the current focus
> is on Text1 and if you click the toolbar button, then Text1 will not
> fire LostFocus Event. But if it is a normal command button, it fires
> LostFocus Event. To handle this and validate Text1 add below code
> in toolbar click event.
>
> Private Sub Toolbar1_ButtonClick(ByVal Button As MSComctlLib.Button)
> If Me.ActiveControl.Name = "Text1" And Button <> "Cancel" Then
> If ValidationFails Then
> Text1.SetFocus
> Else
> Do Necessary Processing
> End If
> End If
> End Sub
>
>
>
> Liju
> > -----Original Message-----
> > From: Rajesh Sivadasan [SMTP:nightriders2@y...]
> > Sent: Monday, March 19, 2001 1:00 PM
> > To: professional vb
> > Subject: [pro_vb] Re: ToolBar Control
> >
> > hi liju,
> > It is not the commandbuton. It is a toolbar control (ActiveX Component
in
> > MS Windows Common Controls 6 ) and it does not have a causesvalidation
> > property.
> > -Rajesh
> > ----- Original Message -----
> > From: liju thomas <lthomas@e...>
> > To: professional vb <pro_vb@p...>
> > Sent: Sunday, March 18, 2001 10:01 PM
> > Subject: [pro_vb] Re: ToolBar Control
> >
> >
> > > Hi,
> > >
> > > Make the CausesValidation property of Cancel button as false.
> > > So when you shift the focus to Cancel button the validate event
> > > will not get fired. You can assign this property during design time.
> > >
> > >
> > > Liju
> > >
> > >
> > >
> > >
> > >
> > > > hi members,
> > > > Can anybody please help me with toolbar control. I have submitted
> > this
> >
> > > > query a month ago also but unfortunately i couldn't get any reply
from
> >
> > > > anybody.
> > > > I am using a toolbar control on a data entry form. The toolbar
> > > > contains, ADD, CHANGE, DELETE, SAVE,CANCEL and EXIT buttons. On the
> > form
> > >
> > > > I am validating the data in the validate event of textboxes. Until a
> > > > valid data is entered the user cannot move out of the fields. But
this
> >
> > > > has caused a big problem, the user cannot even cancel the operation
by
> >
> > > > using the CANCEL button.
> > > > What should I do? Please someone help me out!
> > > > Thanks.
> > >
> >
> >
> >
> > _________________________________________________________
> >
> > Do You Yahoo!?
> >
> > Get your free @yahoo.com address at http://mail.yahoo.com
> >
> >
> >
> >
>
>