00:00
00:00
Newgrounds Background Image Theme

markololohands just joined the crew!

We need you on the team, too.

Support Newgrounds and get tons of perks for just $2.99!

Create a Free Account and then..

Become a Supporter!

VB - Event 'Load' cannot be found.

5,588 Views | 5 Replies
New Topic Respond to this Topic

i've been having this problem for a while now. the only error is the "event 'load' cannot be found" and i've searched high and low for a solution to it. the code is for a skype auto-responder.

could somebody help me find the solution to it please? :0

Imports System
Imports SKYPE4COMLib
Imports System.Windows.Forms

Module SkypeAutoResponder
    Sub Main()

    End Sub
    Public Class Line

    End Class
    Public Class Form1
        Private skype As Skype
        Dim trigger As String = "msg=" 'use this as the command.
        Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
            skype = New Skype
            skype.Attach() 'attaches our program to skype.
            AddHandler skype.MessageStatus, AddressOf skype_stat
        End Sub
        Public Sub skype_stat(ByVal msg As ChatMessage, ByVal status As TChatMessageStatus)
            If msg.Body.Contains(trigger) Then 'if it has the trigger.
                Dim sendme As String = msg.Body.Replace(trigger, "") 'removes the trigger from the message. for example if the message was "msg=sunlight", the it would be "sunlight"
                skype.SendMessage(msg.Sender.Handle, cases(sendme)) 'sends message.
            End If

        End Sub
        Public Function cases(ByVal sent As String)
            Dim result As String
            Select Case sent

                Case Is = "HELP"
                    result = "nice to make your acquantance (or however it's spelt). i am c86, a dumb ai programmed to speak for my creator, ollie, and to mimic his likeness as much as possible." ' then send hey.
                    Exit Select
                Case Is = "hey."
                    result = "hey!"
                    Exit Select
                Case Is = "how're you?"
                    result = "not bad thanks, actually feeling kind of digital. hehe. how're you? ^u^"
                    Exit Select
                Case Is = "i feel awful!"
                    result = "sorry to hear that. :( i would be more sympathetic, but i'm just an ai."
                    Exit Select
                Case Is = "i feel great!"
                    result = "i wish i was programmed complex enough to feel emotion. :/"
                    Exit Select
                Case Is = "later."
                    result = "later! :D"
                    Exit Select
                Case Else
                    result = "Not a valid command"
            End Select

            Return result

        End Function
    End Class

End Module

Response to VB - Event 'Load' cannot be found. 2013-11-02 09:42:24


oh, it also opens as a console application, sorry for not mentioning sooner.

Response to VB - Event 'Load' cannot be found. 2013-11-02 15:02:38


At 11/2/13 01:14 PM, deckheadtottie wrote: For starters, you're mixing up Console applications and Windows Form applications. To be brutally honest, it looks like you've obtained this code from places unknown and don't really know what to do with it.

To get you started and to "fix" your current problem, remove the following from your code.

Sub Main()

End Sub
'And...
Module SkypeAutoResponder

End Module

Place the class definition

Public Class Line

in it's own class file.

Further reading on Classes vs Modules (Hint: you very rarely want a module)

thanks a lot! here's what i've got

Imports System
Imports SKYPE4COMLib
Imports System.Windows.Forms

Public Class Form1
    Private skype As Skype
    Dim trigger As String = "msg=" 'use this as the command.
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        skype = New Skype
        skype.Attach() 'attaches our program to skype.
        AddHandler skype.MessageStatus, AddressOf skype_stat
    End Sub
    Public Sub skype_stat(ByVal msg As ChatMessage, ByVal status As TChatMessageStatus)
        If msg.Body.Contains(trigger) Then 'if it has the trigger.
            Dim sendme As String = msg.Body.Replace(trigger, "") 'removes the trigger from the message. for example if the message was "msg=sunlight", the it would be "sunlight"
            skype.SendMessage(msg.Sender.Handle, cases(sendme)) 'sends message.
        End If
    End Sub
    Public Function cases(ByVal sent As String)
        Dim result As String
        Select Case sent

            Case Is = "HELP"
                result = "nice to make your acquantance (or however it's spelt). i am c86, a dumb ai programmed to speak for my creator, ollie, and to mimic his likeness as much as possible." ' then send hey.
                Exit Select
            Case Is = "hey."
                result = "hey!"
                Exit Select
            Case Is = "how're you?"
                result = "not bad thanks, actually feeling kind of digital. hehe. how're you? ^u^"
                Exit Select
            Case Is = "i feel awful!"
                result = "sorry to hear that. :( i would be more sympathetic, but i'm just an ai."
                Exit Select
            Case Is = "i feel great!"
                result = "i wish i was programmed complex enough to feel emotion. :/"
                Exit Select
            Case Is = "later."
                result = "later! :D"
                Exit Select
            Case Else
                result = "Not a valid command"
        End Select

        Return result

    End Function
End Class

Public Class Line

End Class

however, it looks like i'm still getting the load error. :(

Response to VB - Event 'Load' cannot be found. 2013-11-05 11:56:51


At 11/3/13 06:45 AM, deckheadtottie wrote:
At 11/2/13 03:02 PM, neonpaint wrote: however, it looks like i'm still getting the load error. :(
Just to clarify, have you created a console or a form application?

You cannot have form load events in a console app. For simplicity, create a Windows Form Application if you have not done so.

ok, so i changed it to a windows form application and now it's giving a sub main error as well. :/

'Sub Main' was not found in 'SkypeAutoResponder'

Response to VB - Event 'Load' cannot be found. 2013-11-08 21:45:36


would somebody be able to give me a hand with this please? i've been searching all over the internet and there have been no solutions so far.

Response to VB - Event 'Load' cannot be found. 2013-11-08 22:27:19


At 11/8/13 09:45 PM, neonpaint wrote: would somebody be able to give me a hand with this please? i've been searching all over the internet and there have been no solutions so far.

All programs need a Main function to step into, or else your program can't execute properly.


To protect the world from devastation.

kidd25 is the best Newgrounder ever.

BBS Signature