[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Combo boxes in Tab control becoming selected when switching tabs

Posted on 2004-10-06
2
Medium Priority
?
239 Views
Last Modified: 2011-09-20
I know the title of the question doesn't make much sense.  I'll try to explain further.

I have an app with multiple forms containing tab controls.  The tab controls have combo boxes on them.  Any time I run the app and move between tabs on any of the forms, all of the combo boxes on the tabs become selected.  

This one is driving me mad.  Does anyone know how to make them stop?  It is only the combo boxes.  I also have text boxes on the tabs, but they are unaffected by this apparent phenomenon.

Any help is greatly appreciated.

Regards,
Sekans
0
Comment
Question by:Sekans
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 8

Accepted Solution

by:
bramsquad earned 375 total points
ID: 12241606
i had this same problem when i would refresh a datagrid

im not sure what causes it, or why it happens, but i just changed the selection index everytime

use this code in your program
   
    Private Sub TabControl1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles TabControl1.SelectedIndexChanged
        Me.ComboBox1.SelectionLength = 0
    End Sub

~b
0
 
LVL 1

Author Comment

by:Sekans
ID: 12242622
bramsquad,

I don't believe this is a good option for me.  I have numerous forms with tab controls.  Each tab control has numerous combo boxes.  I would have to customize the code snippet for each combo box.

I found another solution.  I pasted the following code into each tab control's click event.

Dim ctrl As Control
For Each ctrl In Me.Controls
     If Left(ctrl.Name, 3) = "cbo" Then
        ctrl.SelLength = 0
    End If
Next ctrl

The "cbo" is simply the naming convention prefix I use for combo boxes.  I was hesitant to do this as I thought it could slow the screen repaint, but it hasn't affected it at all.

However, you provided a working solution so the points are yours.

Thanks for the timely response.

Sekans
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses

656 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question