C# 
public static int Compare (
string strA,
string strB
)
 
Parameters
strA
The first String. strB
The second String. Return Value
A 32-bit signed integer indicating the lexical relationship between the two comparands. 
Value 
 Condition 
 
Less than zero 
 strA is less than strB. 
 
Zero 
 strA equals strB. 
 
Greater than zero 
 strA is greater than strB. 
 

解决方案 »

  1.   

    if(ss==yy)
    {
       boy.Checked=true;
    }
    else 
    {
       gril.Checked=true;
    }
      

  2.   

    if(string.Compare(ss,yy)==1)
    都是字符串,直接if(ss==yy)不就可以了吗?
      

  3.   

    if(ss==yy)
    {
       boy.Checked=true;
    }
    else 
    {
       gril.Checked=true;
    }
    这样的程序我用了但是不管用一直在显示性别的时候还是不变?
      

  4.   

    比较字符串要用equals()来比较值,==在这里比较的是引用。
    改成:
    if(ss.equals(yy))
    {
     boy.checked = true;
    }
    else
    {
     gril.checked = true;
    }
      

  5.   

    if(o["性别"].ToString() == 0)
    {
    yy = 男; 
     boy.checked = true;
    }
    else
    {
    yy = 女; 
     boy.checked = false;}
    这样写多好。