Solved

dialog

Posted on 2004-10-01
4
223 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
Comment Utility
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
Comment Utility
I am using VB .net
0
 
LVL 85

Accepted Solution

by:
Mike Tomlinson earned 20 total points
Comment Utility
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
Comment Utility
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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Purpose To explain how to place a textual stamp on a PDF document.  This is commonly referred to as an annotation, or possibly a watermark, but a watermark is generally different in that it is somewhat translucent.  Watermark’s may be text or graph…
Displaying an arrayList in a listView using the default adapter is rarely the best solution. To get full control of your display data, and to be able to refresh it after editing, requires the use of a custom adapter.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

771 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

10 Experts available now in Live!

Get 1:1 Help Now