Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

dlgColor 1

Status
Not open for further replies.

dplotts

MIS
Jul 28, 2003
48
0
0
US
I'm trying to display the color dialog box to change the color of text in a label.

Using this code...

Private Sub mnuColor_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuColor.Click

With dlgColor
.showDialog()
lblTotalPay.ForeColor = .color
End With
End Sub

I get an error that dlgColor isn't declared. What am I doing wrong?

 
For your code to work, the CommonDialog control would have to be embedded in your form, for example. But, that control is not supported in VB.NET; it has been replaced by these controls:

ColorDialog control
FontDialog control
OpenFileDialog control
PageSetupDialog control
PrintDialog control
PrintPreviewDialog control
SaveFileDialog control

In your case, you need the ColorDialog control. Drag and drop it from your toolbox.

__________________________________________
Try forum1391 for lively discussions
 
Private Sub mnuColor_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuColor.Click
With ColorDialog1
.ShowDialog()
Me.lblTotalPay.ForeColor = .Color
End With
End Sub

Works! And is same with your code
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top