Combo box question

thejesus
02-18-2005, 12:58 PM
I'm having a frustrating problem with a combo box.

I have a combo box named 'lstDestination' and I want a text box named 'txtIP' to display a certain IP address that corresponds to an item that the user might select from the combo box.

Below is a sample of the code that is supposed to enter a certain IP into txtIP when a user selects 'DNS Server' from the combo box.

For some reason, when I select an item from the combo box, nothing happens to txtIP at all. This seems like a simple enough operation but I can't get it to work.

IfI set 'DNS Server' as the default item when the form loads and then add the same If/Then statement to Private Sub Form_Load(), the correct IP will show up in txtIP with no problem, so I know my spelling is all correct. I can't figure out why the operation won't work in Private Sub lstDestination_Change()

I appreciate any help anyone can give. Thanks : )

Private Sub lstDestination_Change()
If lstDestination.Text = "DNS Server" Then
txtIP.Text = "10.228.0.3"
End If

End Sub

Cookie_Monster
02-18-2005, 01:04 PM
Hi,

This is the Click Event that was fired instead of the Change Event.

Change Event occurs when you type text in Combobox.

I suggest you to use both event.

thejesus
02-18-2005, 01:12 PM
Hi,

This is the Click Event that was fired instead of the Change Event.

Change Event occurs when you type text in Combobox.

I suggest you to use both event.

it works!

thanks cookie monster!

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum