Color Dialog

W

WhoopDing

How do I display a Color Dialog in the client browser?

I want the Color Dialog to be displayed when the user clicks a button.
 
W

WhoopDing

Sorry, maybe I should be a bit more specific.

I am new to .Net. So, my query is no doubt a simple one.

I have the folowing code in the WebForm:
Imports System.Windows.Forms.ColorDialog

....

Private ColorDialog As New Windows.Forms.ColorDialog

The problem I get is I get an error when the button that opens then
ColorDialog is clicked.

This is the error:

It is invalid to show a modal dialog or form when the application is not
running in UserInteractive mode. Specify the ServiceNotification or
DefaultDesktopOnly style to display a notification from a service
application.

The code in the Button Click EventHnadler is:

Private Sub cmdColor_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles cmdColor.Click

ColorDialog.ShowDialog()

If ColorDialog.ShowDialog = Windows.Forms.DialogResult.OK Then

pnlColor.BackColor = ColorDialog.Color

End If

End Sub
 
S

Scott Allen

Yes, WhoopDing - this is what I was trying to point out.

In ASP.NET development you can't use classes from System.Windows.Forms
to pop up dialogs and such on a user's screen.

The client's web browser makes a request to your application, and your
application should respond with HTML and JavaScript that the browser
can interpret and display. The code you are working with executes on
the server - you don't want to pop up a dialog on the web server.

Hope this is making some sense,
 
W

WhoopDing

OK, I have that. How, then, do I cause the browser to open a dialog box
where the user can select a color?

Forgive my newness!

Thanks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,994
Messages
2,570,223
Members
46,812
Latest member
GracielaWa

Latest Threads

Top