auxcom Posted April 28, 2004 Posted April 28, 2004 How can I select a combobox item w/o firing the SelectedIndexChanged and change a combobox text w/o firing the TextChanged events?? Thanks! Quote
Trancedified Posted April 28, 2004 Posted April 28, 2004 If you have the item selected in the combobox.. you can do: msgbox(combo1.SelectedItem) Hope that helps! Chris Quote
Leaders Iceplug Posted April 29, 2004 Leaders Posted April 29, 2004 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 Quote Iceplug, USN One of my coworkers thinks that I believe that drawing bullets is the most efficient way of drawing bullets. Whatever!!! :-(
auxcom Posted April 29, 2004 Author Posted April 29, 2004 There is a part of my program to re-initialize data entry controls to their defaults values like empty strings and no selected items. Quote
AlexCode Posted April 29, 2004 Posted April 29, 2004 And you can also remove and re-assign the event handler... Alex :p Quote Software bugs are impossible to detect by anybody except the end user.
auxcom Posted April 29, 2004 Author Posted April 29, 2004 Remove and re-assign the event handler? Can you show how to do it? Quote
Arch4ngel Posted April 29, 2004 Posted April 29, 2004 cmb.SelectedIndexChanged += null; cmb.SelectedIndexChanged += new EventHandler(MyFunction); Quote "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
auxcom Posted April 29, 2004 Author Posted April 29, 2004 cmb.SelectedIndexChanged += null; cmb.SelectedIndexChanged += new EventHandler(MyFunction); Look quite strange, Im into VB. Quote
Administrators PlausiblyDamp Posted April 29, 2004 Administrators Posted April 29, 2004 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. Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
auxcom Posted April 29, 2004 Author Posted April 29, 2004 Now I know... Thanks alot to all people and ideas! Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.