VB: Combo Box Text Disappears On Selected Index Change

thechris

Newcomer
Joined
Feb 26, 2006
Messages
3
Location
Wiltshire, UK
Hi,

In VB I have a combobox with a default text value, "options". When the form is dropped down, naturally, an item can be selected from the combo box. A procedure is called on SelectedIndexChanged. However, nothing is shown in the text area of the combo box after an option has been selected. I want it to display the value the user has selected, but it is just blank :p

What am I missing?

It's worth mentioning that I'm pretty new to VB, and programming in general.

Any help would be greatly appreciated, thanks in advance.

- Chris.

(ps: This is my first post, but I'll definitely be hanging around here!) :)
 
Hi, thanks for your reply.

My code for the event is as follows:

Code:
Private Sub ComDay_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComDay.SelectedIndexChanged
        Call CalculateDays(ComDay.Text, ComDay2.Text, ComDay3.Text)
    End Sub

I think this is what you require :p

It is the ComDay combo box with which the text is not present. The procedure called is a calculation of the parameters passed to it (and does not return a value).
 
So, what do you have for code inside of the CalculateDays? Also, as a quick test, find the value of ComDay.Text immediately before the call to CalculateDays. Hint: MessageBox.Show(ComDay.Text)
:)
 
Fixed :p

I was so sure it was nothing to do with the procedure (and posting is my last resort after fixing all the problems I can). Turns out the were some unwanted .Items.Clear in there. Deleted them, and what do you know, it fixed the problem!

D'oh! Sorry about that. Thanks a lot for your help anyway!

- Chris.
 
Back
Top