Solved

Fluent.Toc VB.NET AOL/AIM Programming question

Posted on 2004-08-24
4
466 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 150 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Does the idea of dealing with bits scare or confuse you? Does it seem like a waste of time in an age where we all have terabytes of storage? If so, you're missing out on one of the core tools in every professional programmer's toolbox. Learn how to …
A short article about a problem I had getting the GPS LocationListener working.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…

863 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

Need Help in Real-Time?

Connect with top rated Experts

25 Experts available now in Live!

Get 1:1 Help Now