|
-
Aug 6th, 2005, 11:49 PM
#1
Thread Starter
Addicted Member
Detecting if variables have been changed
I have a main form that shows another options dialog. Once the options form has been changed, I want properties on the main form to be changed as a result. However, how could I detect if the variables have been changed? BTW, I am sharing the vars in a module. I considered making it detect the vars once the user moves his mouse over the main form, but I want to know if there is a better way. Would a timer be better or is there an even better way? Thanks!
A programmer is a person who fixes a problem you did not know you had in a way that you cannot understand.
-
Aug 7th, 2005, 12:16 AM
#2
Re: Detecting if variables have been changed
I'm confused.. If you have routines in place to change the data, shouldn't they also be able to set the properties elsewhere? Is there a specific type of variable or scenario giving you trouble? Most of the form objects have a .changed or .selectedindexchanged event you can handle..
Bill
-
Aug 7th, 2005, 12:39 AM
#3
Thread Starter
Addicted Member
Re: Detecting if variables have been changed
I am not just setting properties on the main form. For example, if I want the form to become topmost then immediately not topmost, i had:
VB Code:
If Vars.popup = "True" Or System.Configuration.ConfigurationSettings.AppSettings("configpopup") = True Then
Me.TopMost = True
Me.TopMost = False
End If
A programmer is a person who fixes a problem you did not know you had in a way that you cannot understand.
-
Aug 7th, 2005, 02:47 AM
#4
Re: Detecting if variables have been changed
Unless you keep two copies of the settings then you aren't to know whether they've changed. Why don't you just run through all the settings and set whatever properties they correspond to accordingly. That way the ones that have changed will be reflected and the ones that haven't will just stay as they are. The alternative would be to create events attached to those properties, but that's probably more effort than it's worth.
-
Aug 7th, 2005, 04:02 AM
#5
Re: Detecting if variables have been changed
 Originally Posted by conipto
I'm confused.. If you have routines in place to change the data, shouldn't they also be able to set the properties elsewhere? Is there a specific type of variable or scenario giving you trouble? Most of the form objects have a .changed or .selectedindexchanged event you can handle..
Bill
Pardon me if i am incorrect here, but isn't the task ou are performing here redundant?
why are you making your form topmost, and then not topmost?
Is this to bring it to the front of the screen but not remain covering everything up? because i do believe .show performs this same action of bring the form to the top, i think you can also use .focus as well.
-
Aug 7th, 2005, 04:13 AM
#6
-
Aug 7th, 2005, 04:26 AM
#7
Re: Detecting if variables have been changed
 Originally Posted by uniquegodwin
No pal,...
.show just shows the form..if u use .show again,it doesnt bring the form on top 
it appears you are correct. the only other way is with an API Call
nevermind then.
-
Aug 7th, 2005, 11:38 AM
#8
Re: Detecting if variables have been changed
How about if you made those variables private members of a class, then expose them as properties. Add a variable to the class along the lines of ImChanged, and set it when the Set part of the property is run.
There are two problems I see with this, which may not be problems for you:
1) If the property changes from A to B, then changes from B to A, the property will remain effectively unchanged, but the class will not remember that unless it needs to be designed to always remember that the property started at A.
2) I can't remember the other issue, but I'm sure there was one.
My usual boring signature: Nothing
 
-
Aug 7th, 2005, 06:17 PM
#9
Re: Detecting if variables have been changed
 Originally Posted by uniquegodwin
No pal,...
.show just shows the form..if u use .show again,it doesnt bring the form on top 
If you want to bring a form to the front you call Activate on it.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|