473,396 Members | 1,714 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

DLL and form updating problem

Hi,

I tried the first part of the suggested code below (in a test program first),
and all I get is an error telling me that
"System.Windows.Forms.ToolStripStatusLabel" is not define and the same for
"System.Windows.Form.Listbox"

With that DLL I'm trying to fill a listbox with many filename from a directory,
I tried the code before in the main window code, but when I try it from a DLL, I
can not get the program to run

The declaration and call for the DLL is as follow
Dim dll as New Library
dll.getfile(ToolStripStatusLabel, FileList_VIew)

In the DLL
Public Class Library
Public Sub getfile(ByVal mylabel as
System.Windows.Forms.ToolStripStatusLabel, ByVal FileList_View as
System.Windows.Forms.Listbox)
'the processing code
myLabel.text = i & " files were found ! "
end sub
end class

What do I DO wrong here

Thank you in advance
Martin
____________________________
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


--
Thank you in Advance

Merci a l'Avance

Martin
Apr 6 '06 #1
1 1383
Martin,

You need to add a reference to System.Windows.Forms.

In VS2003 you can do that by clicking the Add Reference menu item from the
Project menu, or by right-clicking References from the Solution Explorer
window.

Kerry Moorman
"Martin Racette" wrote:
Hi,

I tried the first part of the suggested code below (in a test program first),
and all I get is an error telling me that
"System.Windows.Forms.ToolStripStatusLabel" is not define and the same for
"System.Windows.Form.Listbox"

With that DLL I'm trying to fill a listbox with many filename from a directory,
I tried the code before in the main window code, but when I try it from a DLL, I
can not get the program to run

The declaration and call for the DLL is as follow
Dim dll as New Library
dll.getfile(ToolStripStatusLabel, FileList_VIew)

In the DLL
Public Class Library
Public Sub getfile(ByVal mylabel as
System.Windows.Forms.ToolStripStatusLabel, ByVal FileList_View as
System.Windows.Forms.Listbox)
'the processing code
myLabel.text = i & " files were found ! "
end sub
end class

What do I DO wrong here

Thank you in advance
Martin
____________________________

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


--
Thank you in Advance

Merci a l'Avance

Martin

Apr 6 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

25
by: Lyn | last post by:
Hi, I am working on a genealogy form. The only table (so far) lists everybody in the family, one record per person. Each record has an autonum ID. The parent form (frmMainForm) displays the...
14
by: el_sid | last post by:
Our developers have experienced a problem with updating Web References in Visual Studio.NET 2003. Normally, when a web service class (.asmx) is created, updating the Web Reference will...
5
by: ortaias | last post by:
I have a form which calls up a second form for purposes of data entry. When closing the data entry form and returning to the main form, things don't work as expected. When I return to the main...
1
by: Manikandan | last post by:
Hi, I have a form with progress bar. I'm querying sql server with large number of records(around 1 lakh) for export The records are written to a text file I'm showing the process running by...
22
by: Zytan | last post by:
I have public methods in a form. The main form calls them, to update that form's display. This form is like a real-time view of data that is changing. But, the form may not exist (it is...
15
by: sara | last post by:
I have a Memo field in a table to hold notes from a conversation a social worker has had with a client (this is for a non-profit). If the user needs to update the memo field, I need to find the...
0
by: adalyc | last post by:
I NEED SOME GUIDENCE WITH UPDATING A COLLECTION OF ITEMS IN A LIST BOX WHEN THE USER CLICKS ON A BUTTON FROM ANOTHER FORM,, i HAVE LISTED THE PROBLEM PARTIALLY. I fIGURED OUT MOST OF THE PROBLEM...
2
by: =?Utf-8?B?VmFuZXNzYQ==?= | last post by:
Hi All! I am with a situation where I am not getting the right updating to the form's fields. The situation is the following one: I have one combobox and one textbox. I am using the...
4
by: Puzzled | last post by:
PHP 4.4 and PHP 5.2.3 on ubuntu. I am running Moodle 1.5.3 and have recently had a problem when updating a course. The $_POST variable is empty but only if a lot of text was entered into the...
16
by: DavidGeorge | last post by:
I have an unbound form with three list boxes. The selections made in these list boxes 'filter' the records that appear in an unbound subform. The subform record source is a query which looks at...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.