User Control strange property behaviour
User Control strange property behaviour
User Control strange property behaviour
User Control strange property behaviour
User Control strange property behaviour
User Control strange property behaviour User Control strange property behaviour User Control strange property behaviour User Control strange property behaviour User Control strange property behaviour User Control strange property behaviour User Control strange property behaviour User Control strange property behaviour
User Control strange property behaviour User Control strange property behaviour
User Control strange property behaviour
Go Back  Xtreme Visual Basic Talk > > > User Control strange property behaviour


Reply
 
Thread Tools Display Modes
  #1  
Old 05-11-2015, 04:54 AM
Oswald Oswald is offline
Regular
 
Join Date: Apr 2005
Posts: 63
Default User Control strange property behaviour


properties of my usercontrol seem not to persist their values. I do something like this:

private Variable as integer

public property blabla as integer
get
return Variable
end get
set (value as integer)
Variable=value
end set
end property

above is the only place Variable ever gets a value assigned to.

1. in the form's load event (that contains the usercontrol) I set the above property
2. from now on the value set in the load event is displayed in the mousemove event (picturebox mousemove in the usercontrol)
3. later changes to the property are fine in all subs(msgbox), but the mousemove event always prints the first value assigned (?????????)



what might be going on ??

not only one member variable, all seem to behave like this,


maybe properties are not to be set at runtime ?

any chance to add a watch to the variable to see all changes to it? (despite there's only 1 place I change it, and I msgbox it.. sigh)
Reply With Quote
  #2  
Old 05-11-2015, 06:01 AM
Oswald Oswald is offline
Regular
 
Join Date: Apr 2005
Posts: 63
Default

I placed a timer on the control which updates a label with the Variables' value each 100 ms seems like I'm manipulating 2 different objects, as the value is steadily wrong, subsequent changes to the property simply not show up in the label.
Reply With Quote
  #3  
Old 05-11-2015, 07:12 AM
Oswald Oswald is offline
Regular
 
Join Date: Apr 2005
Posts: 63
Default

I've managed to display the same variable is as having the value "5" and also "7" on the same screen...

another finding:

I can change a label's text in the control in the form load event, but it doesnt changes later (no error msgs tho)

Last edited by Oswald; 05-11-2015 at 07:59 AM.
Reply With Quote
  #4  
Old 05-11-2015, 08:11 AM
Oswald Oswald is offline
Regular
 
Join Date: Apr 2005
Posts: 63
Default

finally found it:

I've instanced a window at runtime (which wasnt necessary as it was there by design anyway) which contained the control causing me the problems. the control was implicitly referenced from the form in which it was created. so indeed I had 2 different objects.
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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 Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
User Control strange property behaviour
User Control strange property behaviour
User Control strange property behaviour User Control strange property behaviour
User Control strange property behaviour
User Control strange property behaviour
User Control strange property behaviour User Control strange property behaviour User Control strange property behaviour User Control strange property behaviour User Control strange property behaviour User Control strange property behaviour User Control strange property behaviour
User Control strange property behaviour
User Control strange property behaviour
 
User Control strange property behaviour
User Control strange property behaviour
 
-->