dimspyder
September 18th, 2001, 12:30 AM
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
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