?
Solved

Fluent.Toc VB.NET AOL/AIM Programming question

Posted on 2004-08-24
4
Medium Priority
?
505 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone 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

Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
This article will inform Clients about common and important expectations from the freelancers (Experts) who are looking at your Gig.
An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
Starting up a Project

718 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