Solved

dialog

Posted on 2004-10-01
4
226 Views
Last Modified: 2010-04-17
I am able to get my font and color dialog to open and change to what ever I
want.  The code I am using is something like (below).  The problem is when I
hit the cancel button the property of the object will display.  For example,
if I hit cancel on the backgroud color it will turn black because the default
color for the dialog is blk.  I have tried to do something like (next below)
and when I do that it is still calling the default color.  What is the best
way to write for a color dialog?  How do I handle the cancel button?  


sub

 with dlgcolor
.showcolor
rtbcolor = color
end with

dim something as dialogresults
if something <> dailogresults.OK then
rtbcolor = color
end if

end sub
0
Comment
Question by:freebird317
  • 2
  • 2
4 Comments
 
LVL 85

Expert Comment

by:Mike Tomlinson
ID: 12206080
Private Sub Command1_Click()
    On Error GoTo cancelled
    CommonDialog1.CancelError = True
    CommonDialog1.ShowColor
    RichTextBox1.SelColor = CommonDialog1.Color
cancelled:
End Sub
0
 

Author Comment

by:freebird317
ID: 12206128
I am using VB .net
0
 
LVL 85

Accepted Solution

by:
Mike Tomlinson earned 20 total points
ID: 12206990
So sorry:

    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
        If ColorDialog1.ShowDialog = DialogResult.OK Then
            RichTextBox1.SelectionColor = ColorDialog1.Color
        End If
    End Sub

~IM
0
 

Author Comment

by:freebird317
ID: 12207490
That is what I got by when I cancel it is erroring out on me.  Oh well at least it is Saturday so I can play work on it today.  : )
0

Featured Post

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Although it can be difficult to imagine, someday your child will have a career of his or her own. He or she will likely start a family, buy a home and start having their own children. So, while being a kid is still extremely important, it’s also …
An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

776 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question