By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,524 Members | 1,475 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,524 IT Pros & Developers. It's quick & easy.

Convert C# to vb.net help

P: n/a
(IT is saying the Operator '=' is not defined for types
'System.Drawing.Color' and 'System.Drawing.Color'.

(btnface is a color)

If btnFace = Color.White OrElse btnFace = Color.Black Then

res = highlight

Else

res = Color.FromArgb(GetLightIndex(colorInfo1,
btnFace.R, highlight.R, window.R), GetLightIndex(colorInfo1, btnFace.G,
highlight.G, window.G), GetLightIndex(colorInfo1, btnFace.B,
highlight.B, window.B))

End If



It is saying the Public Event Changed(sender As Object, e As
System.EventArgs)' is an event, and cannot be called directly. Use a
'RaiseEvent' statement to raise an event.

Protected Overridable Sub OnChanged()

If Not (Changed) Is Nothing Then

RaiseEvent Changed(Me, EventArgs.Empty)

End If

End Sub 'OnChanged

Thank you for any help!!
Nov 21 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Scorpion,

Convert it first to argb that goes forerver, a piece of code Peter Huang
showed recently in this newsgroup.
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim kc As Color = Color.FromKnownColor(KnownColor.Blue)
Dim cr As Color = Color.FromArgb(kc.ToArgb())
Dim c As KnownColor
For i As Integer = 1 To 137
If Color.FromKnownColor(i).ToArgb() = cr.ToArgb() Then
Debug.WriteLine(CType(i, KnownColor).ToString())
End If
Next
End Sub

Cor
Nov 21 '05 #2

P: n/a
* "scorpion53061" <ad***@nospampleasekjmsolutions.com> scripsit:
(IT is saying the Operator '=' is not defined for types
'System.Drawing.Color' and 'System.Drawing.Color'.

(btnface is a color)

If btnFace = Color.White OrElse btnFace = Color.Black Then
'If btnFace.Equals(Color.White OrElse...'.
It is saying the Public Event Changed(sender As Object, e As
System.EventArgs)' is an event, and cannot be called directly. Use a
'RaiseEvent' statement to raise an event.

Protected Overridable Sub OnChanged()

If Not (Changed) Is Nothing Then

RaiseEvent Changed(Me, EventArgs.Empty)

End If

End Sub 'OnChanged


Remove the 'If Not (Changed)' Is Nothing...' stuff. VB.NET will do the
checking for you.

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
Nov 21 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.