If ColorPicker1 is your DesktopColorPicker, shouldn’t this code
be
if ColorPicker1.IsVisible then ColorPicker1.Close
If that is not the problem, can you share a sample of your code that can reproduce the problem?
This is the first time I played with DesktopColorPicker and I did this:
1- add a property to the Window called my_colorpicker as DesktopColorPicker
2- open event for the Window: my_colorpicker = new DesktopColorPicker
3- one button with this code: my_colorpicker.Show(color.blue,"")
4- another button with this code:
if my_colorpicker.IsVisible Then
my_colorpicker.close
end if
When I run the program and press Button2 the color picker is closed if it is visible.
The problem with the run time errror is when you have a modal window open which has the desktopcolorpicker control added to it and you call the close method against it, and then close your modal window in the same method.
So do your same test just in a modal window using the first line of code i showed.