Click here to Skip to main content
15,887,027 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
Hello :)
i want to create an array of object !
i added my mywinsocket.ocx to my project

check this !


C#
        AxProject1.AxSocket[] Socket = new AxProject1.AxSocket[5];
// load myclass 


        private void button1_Click(object sender, EventArgs e)
        {
            for (int i = 0; i < 5; i++)
            {
                AxProject1.AxSocket Winsock = new AxProject1.AxSocket();
                Winsock.DataArrival += new System.EventHandler(Socket_DataIncome);
                Winsock.ConnectEvent += new System.EventHandler(Connected);
                Socket[i] = Winsock;
                Socket[i].Name = "Socket" + i.ToString();
                Controls.Add(Socket[i]);
            }

        }

        private void Connected(object sender, EventArgs e)
        {

        }

        private void Socket_DataIncome(object sender,AxProject1.__Socket_DataArrivalEvent e)
        {

        }



i got an error in Socket_DataIncome

no overload for '' matches delegate 'system.eventhandler'

can somebody help me

this is link of winsocket.ocx
Download winsocket.ocx size: 11 kb[^]

thanks
Posted
Comments
[no name] 27-Aug-12 20:35pm    
I would say that your event signature does not match what Socket_DataIncome requires. And no I am not downloading it and installing it to find out what the parameters are.

Your problem is in below method


C#
private void Socket_DataIncome(object sender,AxProject1.__Socket_DataArrivalEvent e)
{

}

This error occured due to passing wrong arguments.

C#
System.EventHandler contains below two arguments
1)Object sender
2)EventArgs e
Change your event procedure arguments
 private void Socket_DataIncome(object sender,EventArgs e)
        {
 
        }
 
Share this answer
 
still have error !

it should be like this
C#
object sender,AxProject1.__Socket_DataArrivalEvent e
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900