CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Sep 2001
    Location
    Oregon, USA
    Posts
    12

    Help with Converting (UTF8, Hex, ASCII)

    Hi, I'm not exactly sure whats wrong with the following code, but I have been trying for a bit now to get the syntax correct. The error I get is an "expected array" error if that is of any help. I have a frmConvert that has a txtbox and a lstbox. The user places the text they wish to convert in the txtbox and selects the conversion (e.g. - UTF8, Hex, or ASCII) and hits a cmdConvert button which should display the converted text back into the txtbox. Here is the code below.


    private Sub cmdConvert_Click()
    on error GoTo ConvFailed
    If txtConv.Text = "" then
    Exit Sub
    End If
    If lstType.ListIndex = 0 then txtConv.Text = Converting(0).ToHex(1, 0, txtConv.Text, 0)
    If lstType.ListIndex = 1 then txtConv.Text = Converting(0).ToUTF8(1, 0, txtConv.Text, 0)
    If lstType.ListIndex = 2 then txtConv.Text = Converting(0).ToASCII(1, 0, txtConv.Text, 0)
    ConvFailed:
    MsgBox "Conversion Failed"
    End Sub

    public Sub Form_Load()
    lstType.AddItem "=> Hex"
    lstType.AddItem "=> UTF8"
    lstType.AddItem "=> Regular(ascii)"
    End Sub




    If there is any more required code that you may need from me to understand my situation better, then just reply stating what it is you need. I would greatly appriciate any help you can give. I believe the error is in the syntax of "Then txtConv.Text = Converting(0).ToHex(1, 0, txtConv.Text, 0)". Thanks in advance for all your thoughts/suggestions/help.

    -Frank


  2. #2
    Join Date
    Jun 2001
    Location
    MO, USA
    Posts
    2,868

    Re: Help with Converting (UTF8, Hex, ASCII)

    It would be helpful to see the code for your "Converting" object is this a collection or why the "(0)"???


  3. #3
    Join Date
    Sep 2001
    Location
    Oregon, USA
    Posts
    12

    Re: Help with Converting (UTF8, Hex, ASCII)

    sorry about that, i was a little confused but i have the syntax correct now. i was trying to use a built in function. thanks anyways for the help. i do have a different problem now that i will post in a new thread.

    -frank


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured