Calling AIMLbot.dll from VB.net 2005 problem

2007-07-30
2013-04-22
  • DrPepper808
    DrPepper808
    2007-07-30

    Hi
    I was setting up a VB wrapper to call the AIMLbot.dll.
    all went well untill I tried to set up the log.
    I set up a test just like your GUI  Example.  So all can see

    Imports AIMLbot
    Imports System.IO
    Public Class Form1
        Dim myBot As New Bot
        Dim MyUser As User
        Dim lastrequest As Request = Nothing
        Dim lastresult As Result = Nothing

      Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
            myBot.loadSettings()
            MyUser = New User("Phil", myBot)

    ‘This is the line I am having problems with
    ‘I don’t have a WrittenToLog as part of the myBot Bot Class.

    myBot.WrittenToLog += new Bot.LogMessageDelegate(myBot_WrittenToLog);

    End Sub

    Other then not being able to get the log data, The Bot works great 

     
    • Hi DrPepper808,

      Thanks for the feedback.

      I'm assuming that you have a method called myBot_WrittenToLog in your form's class? Something like:

      Private Sub myBot_WrittenToLog()

      ' Where you handle whatever is in myBot.LastLogMessage

      End Sub

      You'll need it as this is what the delegate is expected to point to. See line 32 onwards in aimlForm.cs in the AIMLGui project to see how I've done it in C#.

      Actually, you might be interested to know that I'm currently working on a new release that contains many improvements, including access to logging events, better event driven support and several bits of re-factoring to improve performance and readability of the code. Expect an announcement sometime this month...

      Hope this helps and let me know how you get on,

      Nicholas

       
    • DrPepper808
      DrPepper808
      2007-07-31

      Ya.  I have a  myBot_WrittenToLog ready to use. 
      I changed "Dim myBot As New Bot" to "Dim withevents myBot As New Bot"
      But I still don't have a event of WrittenToLog.

       
    • DrPepper808
      DrPepper808
      2007-07-31

      The New Code Sounds Cool,  Can't wait :)

       
    • DrPepper808
      DrPepper808
      2007-08-24

      Well.  I think I am ready to Cry.  I have been working on this and reading but I can't not find out why I am missing the WrittenToLog Event.  It does not show up as a Event in VB.   Is there anyone that know C and VB out there that can Help?
      It must be some kind of compatibility issue, but I don’t know C well enough to C it.  lol

       
    • Hi,

      Have just got back from my holidays and noticed your post. Perhaps you need to Google AddHandler? :-)

      http://msdn2.microsoft.com/en-us/library/6yyk8z93\(VS.80).aspx

      should be a good start...

      Hope that helps,

      Nicholas

       
    • Hi,

      I also forgot to mention that I just tried it out and it works for me.

      Best wishes,

      Nicholas

       
    • DrPepper808
      DrPepper808
      2007-08-27

      That was it.  Now I really feel like a PITA  lol.
      Thanks