473,770 Members | 1,989 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

sending messages from a dll to the main app

Hi,

I have an application that contains a class library as another project.
The application basically executes DTS packages on a remote SQL Server.

This works great.

However I want to add some code that will allow the class executing the
current DTS package to send back messages to the main form of the application.

I have tried using throw new system.exceptio n ("message") this only works
when an exception has occured.

The DTS code I use was taken from the net and has on progress, on error, on
start, on finish events that do a console.writeli ne.
Instead I would like the message not to go to the console but sent out to a
form label in the application.

I don't want to have to necessarily call an exception as this will cause me
to drop out of the code which is in fact working perfectly fine.

thank you,

Chris

Nov 22 '05 #1
3 1399
"Chris" <Ch***@discussi ons.microsoft.c om> wrote in message
news:67******** *************** ***********@mic rosoft.com...
Hi,

I have an application that contains a class library as another project.
The application basically executes DTS packages on a remote SQL Server.

This works great.

However I want to add some code that will allow the class executing the
current DTS package to send back messages to the main form of the
application.

I have tried using throw new system.exceptio n ("message") this only works
when an exception has occured.

The DTS code I use was taken from the net and has on progress, on error,
on
start, on finish events that do a console.writeli ne.
Instead I would like the message not to go to the console but sent out to
a
form label in the application.


First, you'll probably get more help with this by asking in one of the SQL
Server newsgroups, perhaps microsoft.publi c.sqlserver.pro gramming or .dts.

You'll have to go look at the API used to execute the remote DTS package to
see if it has any way to pass events back. If it does, then perhaps you
could pick up those events in the .NET class which calls that API. That
class could raise an event when it receives one from the DTS package. The
form could listen for that event and update its label.

John Saunders
Nov 22 '05 #2
Hi Chris,

Exceptions must never be (mis)used to control normal program behaviour -
they are only ever meant to be used for the management of unexpected errors.
The good news is that there is a feature in .NET for solving exactly your
type of problem - delegates/events.

If I understand you right, the following is true of your app - the GUI uses
DTSCode which then uses/calls RemoteSQLServer (excuse my naming).

What you might want to do is create a public event in DTSCode, and when
constructing DTSCode objects from the GUI, 'tell' the DTSCode event that the
GUI 'is interested' to know when the public event in the DTSCode occurs.
Events also allow the passing of information, so your command line messages
can be sent from the DTSCode to the GUI, which in turn can display the
messages on the GUI screen.

If on the other hand you don't have direct access to DTSCode sources, you
could write your own DTSCode wrapper class that wraps the DTSCode
functionality, but which also declares/generates the event when/where
required. In this case your GUI will declare an interest in the public event
of the DTS code wrapper.

Have a look at the following link(s) for examples of this
http://msdn.microsoft.com/library/de...tsTutorial.asp
http://www.codeproject.com/csharp/delegates-part1.asp

HTH,
Patrick
"Chris" wrote:
Hi,

I have an application that contains a class library as another project.
The application basically executes DTS packages on a remote SQL Server.

This works great.

However I want to add some code that will allow the class executing the
current DTS package to send back messages to the main form of the application.

I have tried using throw new system.exceptio n ("message") this only works
when an exception has occured.

The DTS code I use was taken from the net and has on progress, on error, on
start, on finish events that do a console.writeli ne.
Instead I would like the message not to go to the console but sent out to a
form label in the application.

I don't want to have to necessarily call an exception as this will cause me
to drop out of the code which is in fact working perfectly fine.

thank you,

Chris

Nov 22 '05 #3
Hi Chris,

Exceptions must never be (mis)used to control normal program behaviour -
they are only ever meant to be used for the management of unexpected errors.
The good news is that there is a feature in .NET for solving exactly your
type of problem - delegates/events.

If I understand you right, the following is true of your app - the GUI uses
DTSCode which then uses/calls RemoteSQLServer (excuse my naming).

What you might want to do is create a public event in DTSCode, and when
constructing DTSCode objects from the GUI, 'tell' the DTSCode event that the
GUI 'is interested' to know when the public event in the DTSCode occurs.
Events also allow the passing of information, so your command line messages
can be sent from the DTSCode to the GUI, which in turn can display the
messages on the GUI screen.

If on the other hand you don't have direct access to DTSCode sources, you
could write your own DTSCode wrapper class that wraps the DTSCode
functionality, but which also declares/generates the event when/where
required. In this case your GUI will declare an interest in the public event
of the DTS code wrapper.

Have a look at the following link(s) for examples of this
http://msdn.microsoft.com/library/de...tsTutorial.asp
http://www.codeproject.com/csharp/delegates-part1.asp

HTH,
Patrick
"Chris" wrote:
Hi,

I have an application that contains a class library as another project.
The application basically executes DTS packages on a remote SQL Server.

This works great.

However I want to add some code that will allow the class executing the
current DTS package to send back messages to the main form of the application.

I have tried using throw new system.exceptio n ("message") this only works
when an exception has occured.

The DTS code I use was taken from the net and has on progress, on error, on
start, on finish events that do a console.writeli ne.
Instead I would like the message not to go to the console but sent out to a
form label in the application.

I don't want to have to necessarily call an exception as this will cause me
to drop out of the code which is in fact working perfectly fine.

thank you,

Chris

Nov 22 '05 #4

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

Similar topics

15
4313
by: Sven Templin | last post by:
Hello all, our configuration is as following described: - OS: Windows 2000 - Apache server 1.3 - Php 3.8 - MS outlook client 2000 _and_ no SMTP server available in the whole intranet.
2
1942
by: Nis Sarup | last post by:
A customer of mine wants to make a newsletter for their website. The newsletter should be HTML with images and sent to a database of her subscribers. They would like a script where they can easily compose and send the newsletter. I can write that, but wouldnt like to reinvent the weel. Does anybody here have any good recomendations on newsletter composing/sending software? Userfriendliness and simplicity is the key. TIA, Nis.
2
296
by: Chris | last post by:
Hi, I have an application that contains a class library as another project. The application basically executes DTS packages on a remote SQL Server. This works great. However I want to add some code that will allow the class executing the current DTS package to send back messages to the main form of the application.
2
2091
by: Del | last post by:
I have two question on sending email messages from MS Access (Versio 2000, 2002, and 2003). I have a form with a command button to send an email message, the code behide the button is as follows; ============================================================================= Dim strRecipient As String Dim strSubject As String Dim strMessageBody As String
9
4928
by: Miro | last post by:
VB 2003 at the end of the code, this works great. bytCommand = Encoding.ASCII.GetBytes("testing hello send text") udpClient.Send(bytCommand, bytCommand.Length) and this recieves it Dim strReturnData As String = _ System.Text.Encoding.ASCII.GetString(receiveBytes)
8
12098
by: mtsweep | last post by:
Hi, I started a background thread to preform some time intensive tasks for a GUI frontend. This background thread uses a C++ object which requires a windows message loop so I started one in it by calling Application.Run(). Now I can see that messages from the C++ libraries are being processed. But how do I send my own messages to this thread from the GUI frontend? I tried to use delegates/events/etc but it ends up either spawning a...
2
7670
by: nautonnier | last post by:
Hello, I have a C# app that spawns several processes each containing a console app written by another developer in C++. The console app was written first to be just like a console app: it starts, you type a command it does a command and returns a message. I thought I would be able to consume it in my C# app by using the Process.StandardInput in conjunction with the Process.StartInfo.RedirectStandardOutput. The output works fine and I...
1
2945
by: robbiesmith79 | last post by:
Just so this is out there on the web, I battled the past 24 hours about this. Background info... I developed a ecommerce website in PHP 4 on a shared linux hosting plan from GoDaddy and had the html formatted emails sending as text/html and were going fine with limited header information. Then we moved the site over to a Dedicated Linux hosting plan. This time, it's PHP 5. Things are bound to not work as expected moving to a new...
2
3052
by: =?Utf-8?B?R3JlZ0lJ?= | last post by:
Hi All, I have some problems with sending UDP packets using Winsock. I tried to send some to a closed port, and according to the documentation on Microsoft MSDN site (http://msdn.microsoft.com/en-us/library/ms740148(VS.85).aspx) subsequent calls of sendto function should result in returning WSAECONNRESET error code caused by returning ICMP destination unreachable message. My problem is that I do not see such effect, the sendto always...
0
9618
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10259
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10038
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8933
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7456
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5482
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4007
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3609
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2849
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.