473,396 Members | 1,760 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.

Multiple event Args in VB 2005

So I have two handlers:

Expand|Select|Wrap|Line Numbers
  1.    AddHandler dataBackgroundWorker.DoWork, AddressOf DoDualDSIWorkCOM1
  2.    AddHandler dataBackgroundWorker2.DoWork, AddressOf DoDualDSIWorkCOM1
  3.    dataBackgroundWorker.RunWorkerAsync(New Object() {currentSerial})
  4.    dataBackgroundWorker2.RunWorkerAsync(New Object() {currentSerial2})
when I look in the sub DoDualDSIWorkCOM1 I only see the first COM Port being passed in the event args

Expand|Select|Wrap|Line Numbers
  1. Private Sub DoDualDSIWorkCOM1(ByVal sender As Object, ByVal e As DoWorkEventArgs)
  2.         Try
  3.             Dim args() As Object = e.Argument
  4.  
  5.             Dim intloop As Integer
  6.             CType(args(0), IO.Ports.SerialPort).DiscardInBuffer()
  7.             muxClass.GetDualDSIInputCOM1(CType(args(0), IO.Ports.SerialPort))
  8.         Catch ex As Exception
  9.             tListener.AddMethodError(ex)
  10.         End Try
  11.     End Sub
  12.  
How can I get the 2nd COM Port passed in so that when I go to the GetDualDSIInputCOM1 routine I can see both open COM port?
Oct 30 '08 #1
1 991
Teme64
10
Pass both ports to same worker:

Expand|Select|Wrap|Line Numbers
  1. dataBackgroundWorker.RunWorkerAsync(New Object() {currentSerial, currentSerial2})

Expand|Select|Wrap|Line Numbers
  1. Private Sub DoDualDSIWorkCOM1(ByVal sender As Object, ByVal e As DoWorkEventArgs)
  2.   Try
  3.     Dim Ports() As IO.Ports.SerialPort = CType(e.Argument, IO.Ports.SerialPort())
  4.     Dim intloop As Integer
  5.  
  6.     For intloop = 0 to Ports.GetUpperBound(0)
  7.       Ports(intloop).DiscardInBuffer()
  8.       muxClass.GetDualDSIInputCOM1(Ports(intloop))
  9.     Next intloop
  10.   Catch ex As Exception
  11.     tListener.AddMethodError(ex)
  12.   End Try
  13. End Sub
Teme64 @ windevblog.blogspot.com
Nov 1 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: alex | last post by:
Hi, it is possible to define multiple initialization methods so that the method is used that fits? I am thinking of something like this: def __init__(self, par1, par2): self.init(par1,...
5
by: fooooo | last post by:
This is a network app, written in wxPython and the socket module. This is what I want to happen: GUI app starts. User clicks a button to 'start' the work of the app. When start is pressed, a new...
4
by: NutJob | last post by:
Hello, I'm faced with the following problem: I have a (secondary) thread that monitors a socket for incoming message traffic using the select.select() function. Besides that I also have the...
13
by: DraguVaso | last post by:
Hi, I have a Generic List, for instance: Public MyPersonnesDeContact As New System.Collections.Generic.List(Of clsPersonne) My clsPersonne raises some events, and I want to be able to handle...
3
by: | last post by:
Hello, I am trying to get add a product to a cart from a gridview control when a button in the gridview is clicked. I have a book on how to do this in asp.net 2.0 but it is done by specifying...
6
by: James Radke | last post by:
Hello, I have a multithreaded windows NT service application (vb.net 2003) that I am working on (my first one), which reads a message queue and creates multiple threads to perform the processing...
4
by: John Veldthuis | last post by:
I have set up a background worker and now find I need to give it multiple arguments. What is the best way of doing this? An example would be nice.
6
by: Peter M. | last post by:
Hi all, If an event has multiple subscribers, is it possible to cancel the invocation of event handlers from an event handler? Or to be more specific: I'm subscribing to the ColumnChanging...
0
by: =?Utf-8?B?YW5rMmdv?= | last post by:
Hi, Thanks in advance for reading this. Not sure where to post this question, but I hope someone in here can help. Trying to write to Event Log in VS 2005 (.NET 2.0) using Enterprise Library...
27
by: cmdolcet69 | last post by:
Can anyone tell me if its possible to do multiple event args in vb.net?
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
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
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,...
0
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.