473,322 Members | 1,480 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,322 software developers and data experts.

Addhandler problem

Hi,

I've this procedure

Expand|Select|Wrap|Line Numbers
  1. Private Sub ClientSocket_WriteCompleted(ByVal sender As Object, ByVal e As AsyncCompletedEventArgs)
  2. ...
  3. End Sub
and I need to addhandler for it
Expand|Select|Wrap|Line Numbers
  1. Private Sub buttonConnect_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles buttonConnect.Click
  2. ........        
  3. ClientSocket = New SimpleClientTcpSocket()
  4. AddHandler ClientSocket.WriteCompleted, AddressOf ClientSocket_WriteCompleted
  5. End Sub


but always get an error for the AddHandler line
Error 1 Method 'Private Sub ClientSocket_WriteCompleted(sender As Object, e As System.ComponentModel.AsyncCompletedEventArgs)' does not have a signature compatible with delegate 'Delegate Sub Action(Of System.ComponentModel.AsyncCompletedEventArgs)(obj As System.ComponentModel.AsyncCompletedEventArgs)'.

It will only work if i change the procedure to
Expand|Select|Wrap|Line Numbers
  1. Private Sub ClientSocket_WriteCompleted(ByVal e As AsyncCompletedEventArgs)
  2. ...
  3. End Sub

Can anyone tell me what is wrong with the original code and how to solve it instead of removing the sender As Object in the procedure.
Thanks.
Jun 4 '10 #1
2 1730
Aimee Bailey
197 Expert 100+
@cwthong
surely you dont need the sender object, as sender is ClientSocket ?
Jun 16 '10 #2
@AmzBee
Yes, I need it. However the problem can be solved easily by upgrading to vs2010
Jun 16 '10 #3

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

Similar topics

1
by: Luis Esteban Valencia Muñoz | last post by:
Have a dropdownlist created in my LoadMain() which is called from the Page_load: ************************PAGE LOAD********************8Private Sub Page_Load(ByVal sender As System.Object, ByVal e...
1
by: Shapper | last post by:
Hello, I have the following functions: Sub Config(ByVal tb As TextBox, ByVal fd As String) ... AddHandler textBox.DataBinding, AddressOf Me.BindData ... End Sub
4
by: DJ | last post by:
Good morning, Still new at this so please bear with me. I am creating a table dynamically using webcontrols based on the output of a sproc from my database.The table represents test instances...
2
by: Just Me | last post by:
When I print QueryPageSettings gets called a few times before PrintPage is called. I just occurred to me that the problem may be that I do AddHandler each time I print. Is that wrong? If...
6
by: Ron L | last post by:
I have a dataset whose source is a SQL 2k stored procedure that I am trying to display in a datagrid. This datasource has 4 columns that I am interested in here, a text column and 3 value columns...
5
by: Slim | last post by:
i have a simple page, with one button button1. when click it creates a new button button 2 and adds a event handler to it. but when button 2 is clicked nothing happens, why? Partial Class...
3
by: =?Utf-8?B?UnVkeQ==?= | last post by:
Hello All! I may have posted this problem before, but it was awhile ago. I'm working in VS 2003. I have 10 file watch process going. It seems that I can only about 6or 7 to run at the same...
2
by: GS | last post by:
according to help Dim Obj As New Class1 ' Associate an event handler with an event. AddHandler Obj.Ev_Event, AddressOf EventHandler is the way to go, so I tried oBook = oExcel.Workbooks.Add '...
15
by: Nathan Sokalski | last post by:
I have a section of my code that dynamically creates LinkButtons to allow the user to go to the page containing a question they have not answered. The code that creates the LinkButton is called, as...
1
by: Linda Liu[MSFT] | last post by:
Hi Steve, I performed a test based on your description but didn't reproduce the problem on my side. In my test, I create a WinForm application project and add two Buttons on the form. The...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.