Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

dialog

Posted on 2004-10-01
4
Medium Priority
?
230 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 86

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 86

Accepted Solution

by:
Mike Tomlinson earned 60 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

Build and deliver software with DevOps

A digital transformation requires faster time to market, shorter software development lifecycles, and the ability to adapt rapidly to changing customer demands. DevOps provides the solution.

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.
We live in a world of interfaces like the one in the title picture. VBA also allows to use interfaces which offers a lot of possibilities. This article describes how to use interfaces in VBA and how to work around their bugs.
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…
Simple Linear Regression

715 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