Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Data Bases > Microsoft Access > Re: Help with s...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 6 of 16 Topic 30170 of 31273
Post > Topic >>

Re: Help with some VB Code

by Rich P <rpng123@[EMAIL PROTECTED] > May 6, 2008 at 11:37 AM

Silly me!  I am tooting my horn about how VBA doesn't sup****t
multithreading and that you can only do it in OOP.  I forgot to mention
that multithreading requires the use of delegates - here is some sample
code of a program I wrote which does something similar to what this post
is about - being able to control the execution of an operation -
start/stop:


Public Delegate Sub StartSlideShowDelegate()
Private Delegate Sub ShowPicsDelegate(ByVal PicCount As 
      Integer, ByVal str2 As String)
...

btnStopStart.Text = "Stop SlideShow"
btnSinglePicBack.Enabled = False
btnSinglePicFwd.Enabled = False
bRunPics = True
Dim dlgt As StartSlideShowDelegate = New 
    StartSlideShowDelegate(AddressOf StartLoadSlideShow)
Dim state As Integer = 0
Dim ar As IAsyncResult = dlgt.BeginInvoke(New AsyncCallback
   (AddressOf DoneCallback), state)
...

Try
  If Me.InvokeRequired Then
  ' if operating on a thread, invoke a delegate
  ' on the UI thread.
    Dim omd As ShowPicsDelegate = New ShowPicsDelegate
         (AddressOf ShowPics)
    Dim arx As IAsyncResult = Me.BeginInvoke(omd, New 
            Object() {PicCount, str2})
    Me.EndInvoke(arx)
    Return
  End If
...

--you can't do this in VBA.  You can only do this in OOP.

Rich

*** Sent via Developersdex http://www.developersdex.com
***
 




 16 Posts in Topic:
Help with some VB Code
colemanj4 <colemanj4@[  2008-05-05 12:07:44 
Re: Help with some VB Code
Rich P <rpng123@[EMAIL  2008-05-05 18:04:44 
Re: Help with some VB Code
"Albert D. Kallal&qu  2008-05-06 06:00:43 
Re: Help with some VB Code
Tom van Stiphout <no.s  2008-05-06 06:54:15 
Re: Help with some VB Code
Rich P <rpng123@[EMAIL  2008-05-06 10:17:49 
Re: Help with some VB Code
Rich P <rpng123@[EMAIL  2008-05-06 11:37:35 
Re: Help with some VB Code
"Albert D. Kallal&qu  2008-05-07 01:51:06 
Re: Help with some VB Code
Rich P <rpng123@[EMAIL  2008-05-07 10:32:35 
Re: Help with some VB Code
colemanj4 <colemanj4@[  2008-05-06 05:34:46 
Re: Help with some VB Code
"Albert D. Kallal&qu  2008-05-07 01:56:43 
Re: Help with some VB Code
Element <mhammer@[EMAI  2008-05-06 05:38:35 
Re: Help with some VB Code
lyle fairfield <lyle.f  2008-05-07 03:47:15 
Re: Help with some VB Code
lyle fairfield <lylefa  2008-05-07 11:01:31 
Re: Help with some VB Code
colemanj4 <colemanj4@[  2008-05-07 06:10:11 
Re: Help with some VB Code
lyle fairfield <lylefa  2008-05-07 13:29:24 
Re: Help with some VB Code
colemanj4 <colemanj4@[  2008-05-07 11:12:15 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Mon Oct 6 19:25:04 CDT 2008.