Using the VB.net help

J

Jeff Ciaccio

I seem to be doing something wrong. In VBA, the help is quite easy to
follow, but in VBExpress, I often do not find what I am looking for, or it
is not specific to VBExpress even though I have VB selected as the language.

Is there a way to install locally the help specific to VBExpress?

As long as I'm posting, is there a way to use RGB in VB? I want to check to
see if a color is too dark (maybe by adding the 3 values and comparing, so
if
R+G+B < 50
then ...
end if


Thanks
 
J

Jeff Ciaccio

Let me clarify on the color.
I would like to covert me.backcolor to an RGB value and vice versa. I would
like to take the RGB value and compare it to some minimum value to make sure
it is not too dark.
 
A

Armin Zingler

Jeff Ciaccio said:
Let me clarify on the color.
I would like to covert me.backcolor to an RGB value and vice versa.
I would like to take the RGB value and compare it to some minimum
value to make sure it is not too dark.

The Backcolor is a Color object. You can access it's R, G and B properties.


Armin
 
R

rowe_newsgroups

I seem to be doing something wrong.  In VBA, the help is quite easy to
follow, but in VBExpress, I often do not find what I am looking for, or it
is not specific to VBExpress even though I have VB selected as the language.

Is there a way to install locally the help specific to VBExpress?

As long as I'm posting, is there a way to use RGB in VB?  I want to check to
see if a color is too dark (maybe by adding the 3 values and comparing, so
if
    R+G+B < 50
then ...
end if

Thanks

--
Jeff Ciaccio
Physics and AP Physics Teacher
Sprayberry High School; Marietta, GA
Blog:http://sprayberry.typepad.com/ciaccio

IMO the help in Visual Studio isn't as great as it was in classic VB
or in VBA. When I hit a stumper my first stop is usually at this
newsgroup's archive, and then I hit the C# or ASP.NET archive, and
then I stop over at Google, and if all else fails I go to MSDN.

Hope that helps.

Thanks,

Seth Rowe [MVP]
http://sethrowe.blogspot.com/
 
P

Phill W.

Jeff said:
I seem to be doing something wrong.

It's not just you; we're all suffering from it.
In VBA, the help is quite easy to follow, but in VBExpress,
I often do not find what I am looking for, or it is not
specific to VBExpress even though I have VB selected as the
language.

That's because MSDN, which the "new" Visual Basic languages ship with,
includes a heck of lot more than just "VB", including lots (and lots) of
..Net Framework stuff; it's not strictly part of the /language/, but just
try writing a program without it!
Is there a way to install locally the help specific to VBExpress?
So long as you've got the MSDN disk(s), you should be able to install
the Visual Basic-specific bits locally, but you'll still find yourself
rambling off into the rest for some things.

As long as I'm posting, is there a way to use RGB in VB? I want to
check to see if a color is too dark (maybe by adding the 3 values and
comparing, so

The different bits of colour affect the "brightness" differently.
IIRC, you should use something like

Dim bg as Color = ...
Dim fg as Color = ...
Dim iBrightness as Integer _
= bg.Red _
+ 3 * bg.Blue _
+ 6 * bg.Green

' Now: 0 <= iBrightness <= 765 so
' the mid-way point is half of that, 382[-ish]
If ( iBrightness >= 382 ) Then
' Bright colour
fg = Color.Black
Else
' Dark colour
fg = Color.White
End If

Regards,
Phill W.
 
A

Andrew Morton

Phill said:
The different bits of colour affect the "brightness" differently.
IIRC, you should use something like

<snip code>

How about the Color.GetBrightness() function?

Andrew
 
P

Phill W.

Andrew said:
<snip code>

How about the Color.GetBrightness() function?

Damn!

How dare Our Friends in Redmond add /useful/ things like this into the
Framework and not tell me about them! ;-)

Another of my "stock" routines bites the dust ...

Many Thanks,
Phill W.
 
A

Andrew Morton

Phill said:
How dare Our Friends in Redmond add /useful/ things like this into the
Framework and not tell me about them! ;-)

The help says it's been there since version 1.0...
Another of my "stock" routines bites the dust ...

Quick! Go and reply to Jeff Ciaccio's post asking about "getting the total
RGB value" ;-)
Many Thanks,

You're welcome.

Andrew
 
K

Kevinp

I see I'm not the only one that grumbles about MSDN. I've selected VB
as the Language and 99% of the results are in C#. I can't stand it!
 
J

Joergen Bech

Damn!

How dare Our Friends in Redmond add /useful/ things like this into the
Framework and not tell me about them! ;-)

Another of my "stock" routines bites the dust ...

Many Thanks,
Phill W.

No: How dare Our Friends in Redmond shovel poor implementations
onto the framework. The proper name for what their function should
have been

Color.GetBrightnessQuicklyUsingAHalfAssedHack

or something like that.

There are better ways of calculating the brightness, such as
http://alienryderflex.com/hsp.html

Keep your stock routines. At least until you are sure your friends
at Redmond are doing a better job than yourself.

The "Redmond" version was written for speed - not accuracy.

Regards,

Joergen Bech
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top