Quantcast
Channel: VBForums
Viewing all articles
Browse latest Browse all 15927

VS 2010 Seperating Code

$
0
0
I have some old code that I am currently converting / updating, which contains threads.
I will simplyfy it.

I have (numerous) functions that i call in it so that the code can run on multiple threads,

Code:

    Private Delegate Sub DThread_ProgressBarProgressInvoker(ctl As ProgressBar, ProgressValue As Integer)

    Private Sub DThread_ProgressBarProgress(ByVal ProgBar As ProgressBar, ByVal ProgressValue As Integer)
        If ProgBar.InvokeRequired Then
            ProgBar.BeginInvoke(New DThread_ProgressBarProgressInvoker(AddressOf DThread_ProgressBarProgress), ProgBar, ProgressValue)
        Else
            ProgBar.Value = ProgressValue

        End If
    End Sub



    Private Delegate Sub DThread_ToolStripmenuItemEnabledInvoker(ByVal form As Form, ByVal ctl As ToolStripMenuItem, ByVal value As Boolean)

    Private Sub DThread_ToolStripmenuItemEnabled(ByVal form As Form, ByVal CTRL As ToolStripMenuItem, ByVal value As Boolean)
        'this one looks a little strange, but works
        If form.InvokeRequired Then
            form.BeginInvoke(New DThread_ToolStripmenuItemEnabledInvoker(AddressOf DThread_ToolStripmenuItemEnabled), form, CTRL, value)
        Else
            CTRL.Enabled = value
        End If
    End Sub

and and to call the functions

Code:

DThread_ToolStripmenuItemEnabled(NameOf Item,true)
and

Code:

DThread_ProgressBarProgress(NameOfProgressBar, 50)

all this is in one class (startupForm)

what I want to do is separate the invoke processing into a separate file, so that i can use the functions in other programmes, The question is how do i do this, so it the main programme can still find the functiion it calls.

I have tried putting it in a module, but it does not recognise / find the functions

Viewing all articles
Browse latest Browse all 15927

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>