Click here to Skip to main content
15,909,466 members
Home / Discussions / Visual Basic
   

Visual Basic

 
AnswerRe: searching a file from a folder Pin
Ashfield4-Dec-08 1:25
Ashfield4-Dec-08 1:25 
QuestionDesign Problem... Pin
Johndas3-Dec-08 21:13
Johndas3-Dec-08 21:13 
AnswerRe: Design Problem... Pin
Jay Royall3-Dec-08 21:35
Jay Royall3-Dec-08 21:35 
AnswerRe: Design Problem... Pin
Nanda_MR3-Dec-08 22:11
Nanda_MR3-Dec-08 22:11 
QuestionAdding an event (C# code in VB) Pin
MatthysDT3-Dec-08 20:34
MatthysDT3-Dec-08 20:34 
AnswerRe: Adding an event (C# code in VB) Pin
Tom Deketelaere3-Dec-08 22:36
professionalTom Deketelaere3-Dec-08 22:36 
GeneralRe: Adding an event (C# code in VB) Pin
MatthysDT4-Dec-08 2:10
MatthysDT4-Dec-08 2:10 
GeneralRe: Adding an event (C# code in VB) Pin
Tom Deketelaere4-Dec-08 2:20
professionalTom Deketelaere4-Dec-08 2:20 
evilnoodle wrote:
Your second solution is a far miss, VS wont accept that syntax.


Could be didn't really test it its just the code you pasted run thru the converter. (did think it kinda looked strange)

evilnoodle wrote:
The first solution is closer but when I do the EventHandler(pObj, pArgs) I get a compile time error stating that: 'AddressOf' operand must be the name of a method (without parentheses)
When I remove the parenthesis, it works but I get a NullReferenceException on that same line at runtime.


Your function (eventhandler) has to take the same parameters as the event it is delcared for (usually it "sender as object, e as eventargs")

so the code becomes

AddHandler frm.Click, AddressOf EventHandler


    Private Sub EventHandler(ByVal pobj As Object, ByVal pargs As EventArgs)
        'do your code here
        MessageBox.Show("test")
    End Sub


This works on my end. Can you post your code so I can see what might be wrong.
GeneralRe: Adding an event (C# code in VB) [modified] Pin
MatthysDT4-Dec-08 19:56
MatthysDT4-Dec-08 19:56 
GeneralRe: Adding an event (C# code in VB) Pin
Tom Deketelaere4-Dec-08 20:54
professionalTom Deketelaere4-Dec-08 20:54 
GeneralRe: Adding an event (C# code in VB) Pin
MatthysDT4-Dec-08 21:36
MatthysDT4-Dec-08 21:36 
GeneralRe: Adding an event (C# code in VB) Pin
Tom Deketelaere4-Dec-08 21:40
professionalTom Deketelaere4-Dec-08 21:40 
AnswerRe: Adding an event (C# code in VB) Pin
Gideon Engelberth4-Dec-08 3:01
Gideon Engelberth4-Dec-08 3:01 
AnswerRe: Adding an event (C# code in VB) Pin
Dave Doknjas4-Dec-08 13:52
Dave Doknjas4-Dec-08 13:52 
QuestionSerial Port in the toolbox Pin
Subjugate3-Dec-08 19:39
Subjugate3-Dec-08 19:39 
AnswerRe: Serial Port in the toolbox Pin
SelvaShankar3-Dec-08 20:07
SelvaShankar3-Dec-08 20:07 
Questiongetting file name Pin
jishbalan3-Dec-08 18:54
jishbalan3-Dec-08 18:54 
AnswerRe: getting file name Pin
Christian Graus3-Dec-08 19:00
protectorChristian Graus3-Dec-08 19:00 
Questioninsert multiple listbox text to database. Pin
sumit52833-Dec-08 18:47
sumit52833-Dec-08 18:47 
AnswerRe: insert multiple listbox text to database. Pin
Christian Graus3-Dec-08 18:59
protectorChristian Graus3-Dec-08 18:59 
GeneralRe: insert multiple listbox text to database. Pin
sumit52833-Dec-08 19:14
sumit52833-Dec-08 19:14 
GeneralRe: insert multiple listbox text to database. Pin
Mycroft Holmes3-Dec-08 19:41
professionalMycroft Holmes3-Dec-08 19:41 
GeneralRe: insert multiple listbox text to database. Pin
Paul Conrad4-Dec-08 5:02
professionalPaul Conrad4-Dec-08 5:02 
GeneralRe: insert multiple listbox text to database. Pin
sumit52834-Dec-08 17:31
sumit52834-Dec-08 17:31 
QuestionLotto Program Challenge..how would you create this program? Pin
creelo3-Dec-08 17:36
creelo3-Dec-08 17:36 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.