|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
convert text to decimalHi all,
I am trying to follow some instructions for setting a password for VNC. unfortunately I get stuck at the first hurdle: ''DecimalPassword = your password converted to decimal, separated by spaces. ie "255 255 255"' How do I do that? I tried double.parse with no luck. Thanks Pete You mean something like this:
Private Function Pwd2Dec(ByVal Pwd As String) As String Dim MyPwd() As Char Dim DecPwd As New System.Text.StringBuilder MyPwd = Pwd.ToCharArray() For i As Integer = 0 To MyPwd.GetUpperBound(0) DecPwd.Append(Asc(MyPwd(i)).ToString & " ") Next Return DecPwd.ToString End Function Private Function Dec2Pwd(ByVal DecPwd As String) As String Dim MyDec() As String = Split(DecPwd, " ") Dim Pwd As New System.Text.StringBuilder For i As Integer = 0 To MyDec.GetUpperBound(0) 'used cint(val(..)) instead of cint because it won't give a type mismatch when the string isn't numeric Pwd.Append(Chr(CInt(Val(MyDec(i))))) Next Return Pwd.ToString End Function xla76 wrote: Show quoteHide quote > Hi all, > > I am trying to follow some instructions for setting a password for VNC. > unfortunately I get stuck at the first hurdle: > ''DecimalPassword = your password converted to decimal, separated by > spaces. ie "255 255 255"' > > How do I do that? I tried double.parse with no luck. > > Thanks > > Pete > I'm not sure what VNC is looking for, but I might guess that they want the
ASCII value of each character in the password. Try this code. Dim password As String Dim decimalPassword As String = "" Dim counter As Integer ' ----- Get the password itself, somehow. password = PromptUserForPassword() ' ----- Convert to decimal form. For counter = 0 to password.Length - 1 If (counter > 0) Then decimalPassword &= " " decimalPassword &= CStr(Asc(password.Substring(counter, 1))) Next counter ----- Tim Patrick Start-to-Finish Visual Basic 2005 Show quoteHide quote > Hi all, > > I am trying to follow some instructions for setting a password for > VNC. > unfortunately I get stuck at the first hurdle: > ''DecimalPassword = your password converted to decimal, separated by > spaces. ie "255 255 255"' > How do I do that? I tried double.parse with no luck. > > Thanks > > Pete >
Copying from one Database to another VB 2005
Poor performance IDE. Urgent suggestion needed. how to set the Application.ProductVersion resizing controls (webbrowser control) How to capture Mouse clicks and Keystrokes in a VB app Security and file permissions.... only for expert: what's wrong with this code? System.AccessViolationException Text file vs DB Start up form |
|||||||||||||||||||||||