?
Solved

Combo Box - change other boxes when value manually entered

Posted on 2005-04-22
4
Medium Priority
?
328 Views
Last Modified: 2011-08-18
Hi,

     I have a windows app with a combo box.  The user selects a set number and then the set type displays in a disabled text box beside it.  This works fine if the user selects it in the combo box, using the selected_index_changed method.  But if someone types in a valid set number, while it repositions the combo box onto that set number, the text box doesn't update.  I've tried using the same code in the Enter, selected_Value_change, and changecommitted methods but those don't work either.  Is there a way to catch when someone types in the set number in the box and then tabs or clicks out of the box?

JP
0
Comment
Question by:gleznov
  • 2
4 Comments
 
LVL 2

Expert Comment

by:nikkilocke
ID: 13842053
Hi gleznov,

You could trap the "Leave" event. Or the "Validating" or "Validated" events.

Look in your help for the ComboBox class events, and look at Leave - it contains a nice explanation of which events are fired, in which order.

Hope this helps,

Nikki
0
 

Author Comment

by:gleznov
ID: 13842219
OK sorry to change the question up but how can I just make the combo box so that they can't type into it?  I know I've done this before but I've been working with web apps so long now I can't remember, and I can't find the property.  I'm getting errors when I try to trap the leave event, so I'd rather just cut that ability altogether.

JP
0
 
LVL 25

Accepted Solution

by:
RonaldBiemans earned 500 total points
ID: 13842267
Change the dropdownstyle to dropdownlist

to answer the first question maybe try something like this

    Private Sub ComboBox1_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles ComboBox1.TextChanged
        Dim x As Integer = ComboBox1.Items.IndexOf(ComboBox1.Text)
        ComboBox1.SelectedIndex = x
    End Sub

    Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged
        TextBox2.Text = ComboBox1.SelectedItem
    End Sub
0
 

Author Comment

by:gleznov
ID: 13842545
Couldn't get it working, just set them to dropdownlist.  Thanks!

JP
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Article by: Kraeven
Introduction Remote Share is a simple remote sharing tool, enabling you to see, add and remove remote or local shares. The application is written in VB.NET targeting the .NET framework 2.0. The source code and the compiled programs have been in…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…
Suggested Courses

809 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