Solved

dialog

Posted on 2004-10-01
4
224 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
How to split this in C++ 4 94
firstChar challenge 13 110
base64 decode encode 12 121
MacOS and programming in React 7 28
Entering a date in Microsoft Access can be tricky. A typo can cause month and day to be shuffled, entering the day only causes an error, as does entering, say, day 31 in June. This article shows how an inputmask supported by code can help the user a…
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.
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …
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…

920 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now