Link to home
Start Free TrialLog in
Avatar of Johnny
JohnnyFlag for United States of America

asked on

convert c to vb.net please

i have the dll loaded into vb.net
upon pasteing this most things work like the irc. calls
with
public irc = new ircclient  

im havng problems converting this to vb.net 2005 (can someone help me out im not sure how to do the threading part too
thanks
****************************

  public static void Main(string[] args)
    {
        Thread.CurrentThread.Name = "Main";
        irc.SendDelay = 400;
        irc.ActiveChannelSyncing = true;
       
        irc.OnQueryMessage += new IrcEventHandler(OnQueryMessage);
        irc.OnError += new ErrorEventHandler(OnError);
        irc.OnRawMessage += new IrcEventHandler(OnRawMessage);

        string[] serverlist;
        // the server we want to connect to, could be also a simple string
        serverlist = new string[] {"irc.dragonirc.com"};
        int port = 6667;
      string channel = "#OCS";
        try {
            irc.Connect(serverlist, port);
        } catch (ConnectionException e) {
            System.Console.WriteLine("couldn't connect! Reason: "+e.Message);
            Exit();
        }
       
        try {
            irc.Login("SmartIRC", "SmartIrc4net Test Bot");
            irc.RfcJoin(channel);
            new Thread(new ThreadStart(ReadCommands)).Start();
            irc.Listen();
            irc.Disconnect();
        } catch (ConnectionException) {
            Exit();
        } catch (Exception e) {
            System.Console.WriteLine("Error occurred! Message: "+e.Message);
            System.Console.WriteLine("Exception: "+e.StackTrace);
            Exit();
        }
    }
   
ASKER CERTIFIED SOLUTION
Avatar of newyuppie
newyuppie
Flag of Ecuador image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
use http://www.developerfusion.co.uk/utilities/convertcsharptovb.aspx 
to convert yourself, for future reference. i think its the best free converter...
Avatar of Mike Tomlinson
These lines:

        irc.OnQueryMessage += new IrcEventHandler(OnQueryMessage);
        irc.OnError += new ErrorEventHandler(OnError);
        irc.OnRawMessage += new IrcEventHandler(OnRawMessage);

are wiring up event handlers.

They equivalent in VB should be:

        AddHandler irc.OnQueryMessage, AddressOf OnQueryMessage
        AddHandler irc.OnError, AddressOf OnError
        AddHandler irc.OnRawMessage, AddressOf OnRawMessage



Then you will also need to use "AddressOf" when you create your Thread:

    Call (New Thread(AddressOf ReadCommands)).Start
Did that code actually work???...
Avatar of Johnny

ASKER

Error      14      'OnQueryMessage' is not an event of 'Object'.      E:\Projects\ircd stress\ircd stress\Module2.vb      63      24      ircd stress
Error      15      'OnError' is not an event of 'Object'.      E:\Projects\ircd stress\ircd stress\Module2.vb      64      24      ircd stress
Error      16      'OnRawMessage' is not an event of 'Object'.      E:\Projects\ircd stress\ircd stress\Module2.vb      65      24      ircd stress

trying your additions idlemind gives
i didnt see your comments i opened a new question

https://www.experts-exchange.com/questions/22057927/irc-in-c-to-vb-net-conversion.html

id love to get this all to work...that be great!!