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
 

mathpath

Active member
Joined
Aug 21, 2004
Messages
27
Programming Experience
10+
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.
 

JuggaloBrotha

VB.NET Forum Moderator
Staff member
Joined
Jun 3, 2004
Messages
4,524
Location
Lansing, MI; USA
Programming Experience
10+
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
 
Top Bottom