Johnny
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(OnQueryMes sage);
irc.OnError += new ErrorEventHandler(OnError) ;
irc.OnRawMessage += new IrcEventHandler(OnRawMessa ge);
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();
}
}
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(OnQueryMes
irc.OnError += new ErrorEventHandler(OnError)
irc.OnRawMessage += new IrcEventHandler(OnRawMessa
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("
Exit();
}
try {
irc.Login("SmartIRC", "SmartIrc4net Test Bot");
irc.RfcJoin(channel);
new Thread(new ThreadStart(ReadCommands))
irc.Listen();
irc.Disconnect();
} catch (ConnectionException) {
Exit();
} catch (Exception e) {
System.Console.WriteLine("
System.Console.WriteLine("
Exit();
}
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
These lines:
irc.OnQueryMessage += new IrcEventHandler(OnQueryMes sage);
irc.OnError += new ErrorEventHandler(OnError) ;
irc.OnRawMessage += new IrcEventHandler(OnRawMessa ge);
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
irc.OnQueryMessage += new IrcEventHandler(OnQueryMes
irc.OnError += new ErrorEventHandler(OnError)
irc.OnRawMessage += new IrcEventHandler(OnRawMessa
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???...
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!!
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!!
to convert yourself, for future reference. i think its the best free converter...