Events not firing

EmmaLawton

Member
Joined
Jun 9, 2004
Messages
5
Programming Experience
5-10
I have a button on a windows form. The click event is supposed to take the text property of a third party name completion control and add it as an item to a listbox. But the click event doesn't fire.

I have issues with events not firing in other applications I have been working on. Has anyone come across this sort of behaviour before?

Private Sub btnAddUser_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAddUser.Click

Dim strUser AsString

strUser = nccUser.Text

lstUsers.SuspendLayout()

lstUsers.Items.Add(nccUser.Text)

lstUsers.ResumeLayout()

EndSub


Thanks
 
Check that you button is actually named btnAddUser. Other than that, you'd have to check if the click handler is not firing, or there is a problem with your routines to add user. You could do this by printing a message while inside of the handler.



Happy programming.
 
try takeing out these two lines:

lstUsers.SuspendLayout()
lstUsers.ResumeLayout()

so your sub routine looks more like:
VB.NET:
Private Sub btnAddUser_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAddUser.Click
    Dim strUser AsString = nccUser.Text
    lstUsers.Items.Add(strUser)
EndSub
 
Back
Top