Solved

Fluent.Toc VB.NET AOL/AIM Programming question

Posted on 2004-08-24
4
458 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
Comment Utility
Just doubled the points for this question!  I need help on this one bad!
0
 
LVL 3

Expert Comment

by:gillgates
Comment Utility
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
Comment Utility
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
Comment Utility
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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Entering a date in Microsoft Access can be tricky. A typo can cause month and day to be shuffled, entering the day only causes an error, as does entering, say, day 31 in June. This article shows how an inputmask supported by code can help the user a…
A short article about problems I had with the new location API and permissions in Marshmallow
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…

772 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

10 Experts available now in Live!

Get 1:1 Help Now