Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

How can I select a combobox item w/o firing the SelectedIndexChanged

and

change a combobox text w/o firing the TextChanged events??

 

Thanks!

  • Leaders
Posted

If you don't want these events, why are you handling them?

 

If you need them at a certain time, then declare a boolean that determines when you want to execute the event.

Private Sub CBx_SelIdxChanged(...) etc.
 If ReadyToSel Then
 End If
End Sub

Iceplug, USN

One of my coworkers thinks that I believe that drawing bullets is the most efficient way of drawing bullets. Whatever!!! :-(

Posted
There is a part of my program to re-initialize data entry controls to their defaults values like empty strings and no selected items.
Posted

cmb.SelectedIndexChanged += null;

cmb.SelectedIndexChanged += new EventHandler(MyFunction);

"If someone say : "Die mortal !"... don't stay to see if he isn't." - Unknown

"Learning to program is like going out with a new girl friend. There's always something that wasn't mentioned in the documentation..." - Me

"A drunk girl is like an animal... it scream at everything like a cat and roll in the grass like a dog." - Me after seeing my girlfriend drunk and some of her drunk friend.

C# TO VB TRANSLATOR

  • Administrators
Posted

In that case look into AddHandler and RemoveHandler

basic syntax is


Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
	AddHandler ListBox1.SelectedIndexChanged, AddressOf ListBox1_SelectedIndexChanged
End Sub


Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
	RemoveHandler ListBox1.SelectedIndexChanged, AddressOf ListBox1_SelectedIndexChanged
End Sub

Private Sub ListBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs)
	'Your event handler here
End Sub

the addhandler will dynamically wire up the event at runtime while removehandler will un-wire the event handler.

Posting Guidelines FAQ Post Formatting

 

Intellectuals solve problems; geniuses prevent them.

-- Albert Einstein

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...