Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Fluent.Toc VB.NET AOL/AIM Programming question

Posted on 2004-08-24
4
Medium Priority
?
513 Views
Last Modified: 2008-01-09
I am attempting to use the .NET component found here: http://www.fluentconsulting.com/components/Fluent.Toc/

I have never used delegates before, and could use some help.  I do not know how to get an event handler set up to handle incoming aol messages.

Their snippet for this is as follows:

TocClient tc = new TocClient();
tc.Message += new MessageEventHandler(OnMessage);
tc.SignOn("myscreenname","password");
tc.StartListening();
...
protected void  OnMessage(object sender, MessageEventArgs e){
  WriteLine("{0}: {1}",e.From, e.Message);
}

I assume this is a console C# app.  

The code for my VB.NET Windows App:

Public Class Form1
    Inherits System.Windows.Forms.Form
    Dim tc As New Fluent.Toc.TocClient
    Dim msHan As New Fluent.Toc.MessageEventHandler(AddressOf msgHandler)
*WINDOWS FORM DESIGNER generated code*

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        tc.SignOn("MyUserName", "MyPassword")
        tc.StartListening()
        TextBox1.Text = tc.Connected
    End Sub
    Private Sub msgHandler(ByVal sender As Object, ByVal e As Fluent.Toc.MessageEventArgs)
        MsgBox("from: " & e.From & vbCrLf & "message: " & e.Message)
    End Sub
End Class

Can anyone see what I have wrong?

Thanks
0
Comment
Question by:forrest321
  • 2
  • 2
4 Comments
 
LVL 2

Author Comment

by:forrest321
ID: 11885785
Just doubled the points for this question!  I need help on this one bad!
0
 
LVL 3

Expert Comment

by:gillgates
ID: 11888473
Public Class Form1
    Inherits System.Windows.Forms.Form
    Dim tc As New Fluent.Toc.TocClient
    Dim msHan As Fluent.Toc.MessageEventHandler

*WINDOWS FORM DESIGNER generated code*

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
   tc.Message += new MessageEventHandler(OnMessage);
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        tc.SignOn("MyUserName", "MyPassword")
        tc.StartListening()
        TextBox1.Text = tc.Connected
    End Sub
    Private Sub msgHandler(ByVal sender As Object, ByVal e As Fluent.Toc.MessageEventArgs)
        MsgBox("from: " & e.From & vbCrLf & "message: " & e.Message)
    End Sub
End Class


0
 
LVL 3

Accepted Solution

by:
gillgates earned 600 total points
ID: 11888517
Sorry,


Public Class Form1
    Inherits System.Windows.Forms.Form
    Dim tc As Fluent.Toc.TocClient
    Dim msHan As Fluent.Toc.MessageEventHandler

*WINDOWS FORM DESIGNER generated code*

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
tc = New Fluent.Toc.TocClient  
AddHandler tc.Message, AddressOf msgHandler
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        tc.SignOn("MyUserName", "MyPassword")
        tc.StartListening()
        TextBox1.Text = tc.Connected
    End Sub
    Private Sub msgHandler(ByVal sender As Object, ByVal e As Fluent.Toc.MessageEventArgs)
        MsgBox("from: " & e.From & vbCrLf & "message: " & e.Message)
    End Sub
End Class



0
 
LVL 2

Author Comment

by:forrest321
ID: 11892071
Thanks!

Public Class Form1
    Inherits System.Windows.Forms.Form
    Dim tc As Fluent.Toc.TocClient
    'Dim msHan As Fluent.Toc.MessageEventHandler - not needed

*WINDOWS FORM DESIGNER generated code*

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
tc = New Fluent.Toc.TocClient  
AddHandler tc.Message, AddressOf msgHandler
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        tc.SignOn("MyUserName", "MyPassword")
        tc.StartListening()
        TextBox1.Text = tc.Connected
    End Sub
    Private Sub msgHandler(ByVal sender As Object, ByVal e As Fluent.Toc.MessageEventArgs)
        MsgBox("from: " & e.From & vbCrLf & "message: " & e.Message)
    End Sub
End Class
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
This article will inform Clients about common and important expectations from the freelancers (Experts) who are looking at your Gig.
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

886 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question