PC Review


Reply
Thread Tools Rate Thread

Controlling Change event when loading a form

 
 
Gussie
Guest
Posts: n/a
 
      6th Sep 2008
I created an Excel Form 2000 which triggers when user double-clicks on a row,
loading information into the form. In the form there is a disabled SAVE
button that would be enabled when ever a CHANGE is detected.

The problem:
The CHANGE event gets triggered even while loading form, therefore SAVE
button gets enabled, even though no change has been done yet.

I am currently initializing a variable: LOADING_Flag=true when loading, then
controlling the flag as Initialize process is completed. It works but I was
wondering how others are addressing this issue.
 
Reply With Quote
 
 
 
 
Barb Reinhardt
Guest
Posts: n/a
 
      6th Sep 2008
You may want to post your form code.

Barb Reinhardt




"Gussie" wrote:

> I created an Excel Form 2000 which triggers when user double-clicks on a row,
> loading information into the form. In the form there is a disabled SAVE
> button that would be enabled when ever a CHANGE is detected.
>
> The problem:
> The CHANGE event gets triggered even while loading form, therefore SAVE
> button gets enabled, even though no change has been done yet.
>
> I am currently initializing a variable: LOADING_Flag=true when loading, then
> controlling the flag as Initialize process is completed. It works but I was
> wondering how others are addressing this issue.

 
Reply With Quote
 
Gussie
Guest
Posts: n/a
 
      6th Sep 2008
Surething. Form gets loaded from the Worksheet_BeforeDoubleClick event:


Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As
Boolean)

..
code
..
..

frmRouting.Show 'Form gets loaded

bLoadingForm = True 'Loading information
frmRouting.txtRoutingID = Activesheet.cells(Target.Row, 1)
frmRouting.txtOrganizationE = Activesheet.cells(Target.Row, 2)
frmRouting.txtOrganizationF = Activesheet.cells(Target.Row, 3)
frmRouting.strLevel = Activesheet.cells(Target.Row, 4)
bLoadingForm = False 'Loading information already completed
..
..
code
..
..
End Sub

The form get loaded prior to loading information and of course all fields
are blank. Then I initialize each field with information from the worksheet,
which hasn't been changed, but it triggers the xxxxxx_Change() for each of
the text fields.

Using that bLoadingForm flag works but I am just curious as how others have
resolve this issue.

Thank you for replying Barb....


"Barb Reinhardt" wrote:

> You may want to post your form code.
>
> Barb Reinhardt
>
>
>
>
> "Gussie" wrote:
>
> > I created an Excel Form 2000 which triggers when user double-clicks on a row,
> > loading information into the form. In the form there is a disabled SAVE
> > button that would be enabled when ever a CHANGE is detected.
> >
> > The problem:
> > The CHANGE event gets triggered even while loading form, therefore SAVE
> > button gets enabled, even though no change has been done yet.
> >
> > I am currently initializing a variable: LOADING_Flag=true when loading, then
> > controlling the flag as Initialize process is completed. It works but I was
> > wondering how others are addressing this issue.

 
Reply With Quote
 
John_John
Guest
Posts: n/a
 
      6th Sep 2008
Hi!

I think that you have to add the above line after the settings of the
textboxes:

frmRouting.cmdSave.Enabled = false

I think it works.

I suggest to use the "AfterUpdate" event of the textbox to enable the button.

John

Ο χρήστης "Gussie" *γγραψε:

> Surething. Form gets loaded from the Worksheet_BeforeDoubleClick event:
>
>
> Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As
> Boolean)
>
> .
> code
> .
> .
>
> frmRouting.Show 'Form gets loaded
>
> bLoadingForm = True 'Loading information
> frmRouting.txtRoutingID = Activesheet.cells(Target.Row, 1)
> frmRouting.txtOrganizationE = Activesheet.cells(Target.Row, 2)
> frmRouting.txtOrganizationF = Activesheet.cells(Target.Row, 3)
> frmRouting.strLevel = Activesheet.cells(Target.Row, 4)
> bLoadingForm = False 'Loading information already completed
> .
> .
> code
> .
> .
> End Sub
>
> The form get loaded prior to loading information and of course all fields
> are blank. Then I initialize each field with information from the worksheet,
> which hasn't been changed, but it triggers the xxxxxx_Change() for each of
> the text fields.
>
> Using that bLoadingForm flag works but I am just curious as how others have
> resolve this issue.
>
> Thank you for replying Barb....
>
>
> "Barb Reinhardt" wrote:
>
> > You may want to post your form code.
> >
> > Barb Reinhardt
> >
> >
> >
> >
> > "Gussie" wrote:
> >
> > > I created an Excel Form 2000 which triggers when user double-clicks on a row,
> > > loading information into the form. In the form there is a disabled SAVE
> > > button that would be enabled when ever a CHANGE is detected.
> > >
> > > The problem:
> > > The CHANGE event gets triggered even while loading form, therefore SAVE
> > > button gets enabled, even though no change has been done yet.
> > >
> > > I am currently initializing a variable: LOADING_Flag=true when loading, then
> > > controlling the flag as Initialize process is completed. It works but I was
> > > wondering how others are addressing this issue.

 
Reply With Quote
 
Gussie
Guest
Posts: n/a
 
      6th Sep 2008
I have tried both ways with same results. I am going to stick with what I am
doing it, it seems to work. I did some research and downloaded some samples
but in all of them the SAVE button is enabled when form is loaded.

As soon as text box is initialized; events are triggered.

"John_John" wrote:

> Hi!
>
> I think that you have to add the above line after the settings of the
> textboxes:
>
> frmRouting.cmdSave.Enabled = false
>
> I think it works.
>
> I suggest to use the "AfterUpdate" event of the textbox to enable the button.
>
> John
>
> Ο χρήστης "Gussie" *γγραψε:
>
> > Surething. Form gets loaded from the Worksheet_BeforeDoubleClick event:
> >
> >
> > Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As
> > Boolean)
> >
> > .
> > code
> > .
> > .
> >
> > frmRouting.Show 'Form gets loaded
> >
> > bLoadingForm = True 'Loading information
> > frmRouting.txtRoutingID = Activesheet.cells(Target.Row, 1)
> > frmRouting.txtOrganizationE = Activesheet.cells(Target.Row, 2)
> > frmRouting.txtOrganizationF = Activesheet.cells(Target.Row, 3)
> > frmRouting.strLevel = Activesheet.cells(Target.Row, 4)
> > bLoadingForm = False 'Loading information already completed
> > .
> > .
> > code
> > .
> > .
> > End Sub
> >
> > The form get loaded prior to loading information and of course all fields
> > are blank. Then I initialize each field with information from the worksheet,
> > which hasn't been changed, but it triggers the xxxxxx_Change() for each of
> > the text fields.
> >
> > Using that bLoadingForm flag works but I am just curious as how others have
> > resolve this issue.
> >
> > Thank you for replying Barb....
> >
> >
> > "Barb Reinhardt" wrote:
> >
> > > You may want to post your form code.
> > >
> > > Barb Reinhardt
> > >
> > >
> > >
> > >
> > > "Gussie" wrote:
> > >
> > > > I created an Excel Form 2000 which triggers when user double-clicks on a row,
> > > > loading information into the form. In the form there is a disabled SAVE
> > > > button that would be enabled when ever a CHANGE is detected.
> > > >
> > > > The problem:
> > > > The CHANGE event gets triggered even while loading form, therefore SAVE
> > > > button gets enabled, even though no change has been done yet.
> > > >
> > > > I am currently initializing a variable: LOADING_Flag=true when loading, then
> > > > controlling the flag as Initialize process is completed. It works but I was
> > > > wondering how others are addressing this issue.

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Why does loading a form cause a change. Lloyd Sheen Microsoft VB .NET 4 17th Apr 2008 02:49 PM
Code in MDI child form Activated event handler causes form to appear as partially visible when loading RJ Microsoft Dot NET Framework Forms 3 2nd Nov 2006 03:58 PM
Re: cancel loading process in form load event handler Jay B. Harlow [MVP - Outlook] Microsoft VB .NET 0 10th Jul 2003 03:03 PM
cancel loading process in form load event handler Giri Microsoft VB .NET 0 10th Jul 2003 08:31 AM
Re: cancel loading process in form load event handler Stephen Muecke Microsoft VB .NET 0 10th Jul 2003 07:25 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 11:00 AM.