Thanks Morten, appreciate the help. You're right I'm used to VB but I try to
be open about it :-)
Like everyone else, I guess I'll end up learning new stuff.
Thanks again
Bob
"Morten Wennevik" <Mo************@hotmail.comwrote in message
news:op.td4p4u0bklbvpo@stone...
Hi Bob,
in C# = assigns the right value to the left, so strLang = "FR" means store
"FR" in strLang.
if(strLang) will try to determine if strLang is true or false, and the
compiler will complain since a string can't be true or false.
As other have mentioned use == to determine equality and get a boolean value
true or false.
The use of capital P in private and sub in the function name might indicate
you come from a vb background. C# uses lower case p in private although
capital P will work as well.
Furthermore, you will get a compiler error since your method lacks a return
value, a sub i C# written as any other method (Subs and Functions are all
methods in C#) but with 'void' specified as return value
private void Mysub (string strLang)
{
if (strLang == "FR)
// do something
}
On Fri, 11 Aug 2006 18:22:36 +0200, Bob <bd*****@sgiims.comwrote:
In a sub
Private Mysub (string strLang)
{
if (strLang = "FR") Won't compile.
strLang is declared as string in the sub's parameter collection.
I get an error message saying Cannot implicitly convert type 'string' to
'bool'
What am I doing wrong?
Any help would be appreciated
Bob
--
Happy coding!
Morten Wennevik [C# MVP]