谁能把下面的VB代码翻译为C#

Private Function GetKeyByteArray(ByVal sPassword As String) As Byte()
dim byteTemp(7) As Byte
sPassword=sPassword.PadRight(8);
Dim iCharIndex As Integer
For iCharIndex =o To 7
byteTemp(iCharIndex)=Asc(Mid$(sPassword,iCharIndex+1,1))
Next
Return byteTemp
End Function
[320 byte] By [sallyXY-晓毅] at [2007-12-16]
# 1
在C#中
textBox.PasswordChar就可以完成任务!
private void InitializeMyControl()
{
// Set to no text.
textBox1.Text = "";
// The password character is an asterisk.
textBox1.PasswordChar = '*';
// The control will allow no more than 14 characters.
textBox1.MaxLength = 14;
}
# 2
private Byte[] GetKeyByteArray(String sPassword)
{
Byte byteTemp[8];
sPassword = sPassworkd.PadRight(8);
int iCharIndex;
for(iCharIndex = 0; iCharIndex < 8; iCharIndex++)
{
byteTemp[iCharIndex) = Convert.ToInt32(sPassword.SubString(iCharIndex, 1));
}
return byteTemp;
}
Anstinus-GUID at 2007-10-22 > top of Msdn China Tech,.NET技术,C#...
# 3
好像vb不行了啊~~~!
xport-豁然开朗 at 2007-10-22 > top of Msdn China Tech,.NET技术,C#...