David,
Thanks for the response. The actual issue I am working through is a splash
screen.
I have a component library that has a base form and a splash screen form.
All my application forms derive from the custom form, which now has two
additional methods, (ShowWait, HideWait). These methods will be used
primarly for long running processes called by the custom form, however, the
derived form could make use of it as well.
In VB'03 is was working great, my problem is in VB'05. The splash screen is
supposed to fade in and out over time while it is displayed. I encountered
two issues from the conversion.
1. I do not have access to doevents. Since control libraries do not have
access to the My namespace, I have been exploring
Microsoft.VisualBasic.ApplicationServices.WindowsF ormsApplicationBase. I
haven't found a way to associate my ExecutingAssembly with my library.
Threading.Thread.Sleep doesn't seem to do the job, of cource that could be a
result of my second issue.
2. Accessing the splash screens form methods and properties cause:
a. System.Threading.ThreadAbortException
b. System.ArgumentException
c. System.InvalidOperationException
d. System.Transactions Critical at
System.Windows.Forms.Control.SetVisibleCore(Boolea n value)
What I have going on is a do...while loop that is calling the fade routine
when the splash screen is visible.
public sub DoFading
do while not done
call Fade
loop
me.hide()
me.close()
end sub
private sub Fade
dim fadedirection as fadetypes
if me.opacity <= 0 then
fadedirection = fadetypes.up
elseif me.opacity >= 1 then
fadedirection = fadetypes.down
end if
select case fadedirection
case fadetypes.up
me.opacity += pintStepping
case else
me.opacity -= pintStepping
end select
end sub
I changed my call to fade to Me.Invoke(New
Windows.Forms.MethodInvoker(AddressOf Fade))
as well as the logic to hide and close the form
I don't know what I am doing wrong, but it is not behaving like it used to.
"david" <da***@woofix.local.dom> wrote in message
news:sl******************@localhost.localdomain...
On 2006-04-28, AMDRIT <am****@hotmail.com> wrote: Hello everyone,
How do I access a property from another thread in VB'05? Thanks
public class frmblah
inherits system.windows.forms.form
private mCount as integer
private property Count as integer
get
return mCount
end get
set (value as integer)
mCount = value
end set
end property
private sub updatecount
if me.InvokeRequired then
'
'???????
'
else
me.count += 1
end if
end sub
end class
You don't need to worry about InvokeRequired here, that's for accessing
UI components on the UI thread. For ordinary properties, even if they
are properties of a Form class, you can just set them from any thread
(watching out for thread contention of course).