Solved

dialog

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

Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

Question has a verified solution.

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

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.
Q&A with Course Creator, Mark Lassoff, on the importance of HTML5 in the career of a modern-day developer.
Simple Linear Regression
Introduction to Processes

626 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