By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,987 Members | 997 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,987 IT Pros & Developers. It's quick & easy.

Editor Drop-Down Bug...

P: n/a
I wrote an editor for a web control that allows it to list all controls on a
page in a drop down box in the property grid. In the EditValue method, I
have the following (not all the code, but most of it):

^snip^
' Create the listbox to display the control id's.
listBox = New ListBox()

With listBox
.BorderStyle = BorderStyle.None
.Sorted = True
End With

' Get the find and replace control.
ctrl = DirectCast(context.Instance, FindButton)

' Add the controls to the listbox.
AddListItems(listBox, ctrl.Parent.Page.Controls)

' Turn off sorting.
listBox.Sorted = False

' Add the "None" item.
listBox.Items.Insert(0, "None")

' If there is a value, select it.
If CStr(value) = String.Empty
listBox.SelectedItem = "None"
Else
listBox.SelectedIndex = listBox.FindString(CStr(value))
End If

' Display the list as a drop-down.
AddHandler _
listBox.SelectedIndexChanged, _
AddressOf listBox_SelectedIndexChanged
mEditorService.DropDownControl(listBox)
RemoveHandler _
listBox.SelectedIndexChanged, _
AddressOf listBox_SelectedIndexChanged

If listBox.SelectedIndex >= 0
If listBox.SelectedIndex = 0
Return String.Empty
Else
Return CStr(listBox.SelectedItem)
End If
Else
Return CStr(value)
End If
^snip^

Now, when I compile and test it on a web page, in design mode, it works
fine. But if I select the property and open the drop-down box, then
(without selecting an item in the box) select another property the drop-down
box closes, but the property with the drop-down box gets reselected in the
property grid instead of the property I just clicked. Wierd bug and I can't
figure out how to stop it.

Can anyone help?

Thanks in advance, like always ;)

Mythran
Nov 21 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.