-
January 1st, 2021, 03:09 PM
#1
[RESOLVED] Selectively prevent a combobox from scrolling past a certain point Visual Studio 2012
I have two combo boxes on a form.
Both of them contain the letters A - Z. One is loaded foreword (A-Z), the other backward (Z-A).
They also hold the asterisk (*) symbol. They each have 26 indexes (not counting -1).
Currently when a checkbox is checked, the asterisk symbol is selected for both combo boxes and they are disabled - works great.
If the checkbox is NOT checked, I would like to prevent the user from scrolling to that "*" symbol using the UP/DOWN arrows
of the combo box control.
In summary: I only want the checkbox to select that indexed item.
I tried to manually add and remove the "*" but the value where the asterisk is added is changed - I don't want that.
Here is the checkbox code:
Code:
Private Sub Rnd_Letters_CheckedChanged(sender As Object, e As EventArgs) Handles Rnd_Letters.CheckedChanged
Rnd_Letters.Font = IIf(Rnd_Letters.Checked = True, New Font(Rnd_Letters.Font, FontStyle.Bold), New Font(Rnd_Letters.Font, FontStyle.Regular))
ConfigSet = True
If Rnd_Letters.Checked = False Then
Rnd_Letters.Refresh()
ComboBox1.Enabled = True
ComboBox2.Enabled = True
ComboBox1.SelectedIndex = 0 ' Shows the first letter in the combobox
ComboBox1.Refresh()
ComboBox2.SelectedIndex = 0 ' Shows the first letter in the combobox
ComboBox2.Refresh()
No_Repeats.Checked = False
No_Repeats.Enabled = False
RndSet = False
ElseIf Rnd_Letters.Checked = True Then
No_Repeats.Enabled = True
RndSet = True
ComboBox1.SelectedIndex = 26 ' Selects the * symbol
ComboBox1.Enabled = False
ComboBox2.SelectedIndex = 26 ' Selects the * symbol
ComboBox2.Enabled = False
TextBox1.Text = "0"
End If
ConfigSet = False
Check_Defaults()
OKToolStripMenuItem.Enabled = True
SAVEToolStripMenuItem.Enabled = True
End Sub
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
|