-
January 1st, 2021, 03:19 PM
#1
[RESOLVED] Get the SelectedIndexChanged events of a combobox to fire Visual Studio 2012
Hello again.
Same project as in a previous post: https://forums.codeguru.com/showthre...al-Studio-2012
If the user manually types in a value (letter A-Z) I want the SelectedIndexChanged event of that combo box to fire.
Based upon the value in the combo box, a label changes it's text value:
Code:
Private Sub ComboBox1_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ComboBox1.SelectedIndexChanged
If ConfigSet = True Then Exit Sub
If Rnd_Letters.Checked = False Then CalcNumLetters()
Check_Defaults()
OKToolStripMenuItem.Enabled = True
SAVEToolStripMenuItem.Enabled = True
End Sub
Private Sub CalcNumLetters()
Select Case True
Case ComboBox1.Text > ComboBox2.Text
Label10.Text = "Backward"
TextBox1.Text = Str(Math.Abs(Asc(ComboBox1.Text) - Asc(ComboBox2.Text)) + 1)
Case ComboBox2.Text > ComboBox1.Text
Label10.Text = "Foreword"
TextBox1.Text = Str(Math.Abs(Asc(ComboBox2.Text) - Asc(ComboBox1.Text)) + 1)
End Select
TextBox1.Enabled = False
End Sub
-
January 2nd, 2021, 03:41 AM
#2
Re: Get the SelectedIndexChanged events of a combobox to fire Visual Studio 2012
Have you put a breakpoint inside the ComboBox1_SelectedIndexChanged handler to see if it fires at all?
-
January 2nd, 2021, 07:31 AM
#3
Re: Get the SelectedIndexChanged events of a combobox to fire Visual Studio 2012
Yes. I tried other events too. I can't find anything useful.
-
January 2nd, 2021, 07:48 AM
#4
Re: Get the SelectedIndexChanged events of a combobox to fire Visual Studio 2012
Originally Posted by oldGMtireman
Yes. I tried other events too. I can't find anything useful.
You were asked not to try "other events"!
Did you set the breakpoint inside the ComboBox1_SelectedIndexChanged handler to see if it fires?
Victor Nijegorodov
-
January 2nd, 2021, 08:50 AM
#5
Re: Get the SelectedIndexChanged events of a combobox to fire Visual Studio 2012
Post the code where the ComboBox1_SelectedIndexChanged event handler is wired up to the control.
-
January 2nd, 2021, 08:58 AM
#6
Re: Get the SelectedIndexChanged events of a combobox to fire Visual Studio 2012
Where was I asked not to try "other events"?
I answered the second question.
-
January 2nd, 2021, 09:17 AM
#7
Re: Get the SelectedIndexChanged events of a combobox to fire Visual Studio 2012
Originally Posted by oldGMtireman
Where was I asked not to try "other events"?
I answered the second question.
Does it matter? Keep in mind that folks here are trying to help you.
There isn't much to intercepting the select change event. You need the body of the handler and you need the code that wires up the handler to the control. If you have this then you should be able to put a breakpoint inside the handler, and have it hit when you perform the action that causes the event to fire. Once you have that, then you can continue to step through the code inside the handler to make sure it does what you think it does.
There's really only 3 things in play:
1. The user action you perform doesn't fire the event you are handling.
2. The event handler isn't wired up properly.
3. The code inside the handler doesn't work, making you believe the event isn't firing.
All of this can be sorted out by debugging.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|