By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,815 Members | 1,142 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,815 IT Pros & Developers. It's quick & easy.

Visual Basic 2005 Express

P: n/a
Hi,

I recently installed that programing environment, and I'm wondering how to do
some of the things

I created a program that renames, moves, and copies file, most of the routine
are located in a DLL file that I created along with the main program, everything
work fine, but I can not get the routine running in the DLL to update a progress
bar and a label field that I would like the name of the file being processed to
appear

I checked in the help that comes with Visual Basic 2005 Express, but I can not
find how to do this

Any help would be appreciated
--
Thank you in Advance

Merci a l'Avance

Martin
Apr 5 '06 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Martin,

A couple of options:

1. Pass the controls into the class in the dll, either as properties of the
class or as arguments to a method. For example:

Public Class MyClass1

Public Sub DoSomething(ByVal myLabel As System.Windows.Forms.Label)

For i As Integer = 1 To 10
'
'Processing
'
'Display something in the label
myLabel.Text = i.ToString
myLabel.Refresh()
Next

End Sub
End Class

Then on a form, call the method and pass it some control, in this case a
label:

Dim mc1 As New MyClassLibrary.MyClass1

mc1.DoSomething(Label1)

2. In the class in the dll, raise an event. Handle the event on a form. For
example:

Public Class MyClass2

Public Event DidSomething(ByVal SomeValue As Integer)

Public Sub DoSomething()

For i As Integer = 1 To 10
'
'Processing
'
'Raise an event
RaiseEvent DidSomething(i)
Next

End Sub
End Class

On a form:

Private WithEvents mc2 As New MyClassLibrary2.MyClass2

Private Sub mc2_DidSomething(ByVal SomeValue As Integer) Handles
mc2.DidSomething

Label1.Text = SomeValue.ToString
Label1.Refresh()

End Sub

Then call the method and let the event handler update the label:

mc2.DoSomething()

Kerry Moorman


"Martin Racette" wrote:
Hi,

I recently installed that programing environment, and I'm wondering how to do
some of the things

I created a program that renames, moves, and copies file, most of the routine
are located in a DLL file that I created along with the main program, everything
work fine, but I can not get the routine running in the DLL to update a progress
bar and a label field that I would like the name of the file being processed to
appear

I checked in the help that comes with Visual Basic 2005 Express, but I can not
find how to do this

Any help would be appreciated
--
Thank you in Advance

Merci a l'Avance

Martin

Apr 5 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.