I think I am going mental 
Author Message
 I think I am going mental

I have been going spare trying to get round this, I can't seem to get the
Asc() function to work in my script, but i can get it to work in other
circumstances (when i use it as an argument or when I use it in a MsgBox.)

I have tried using CStr etc to see if that makes any difference, It didn't.

my code is below, its probably a stupid problem but I am going mental trying
to get the sodding thing to work.

Function Enc(sText)
Dim j, k,r
Do While j =< len(sText)
k = k &left(sText, j)
r = r & right(k, len(k) - (len(k)-1))
j = j + 1
Loop
msgbox Asc(r)
End Function
This works, but i need it to convert each character to a value.

Function Enc(sText)
Dim j, k, r, o
Do While j =< len(sText)
k = k &left(sText, j)
r = Asc(right(k, len(k) - (len(k)-1)))
j = j + 1
Loop
Msgbox r
End Function
This doesn't work. I have tried other things but nothing seems to work
right.

THANKS

Dominic Marks



Mon, 15 Jul 2002 03:00:00 GMT  
 I think I am going mental

Thanks

Dominic Marks



Tue, 16 Jul 2002 03:00:00 GMT  
 I think I am going mental

Quote:

> I have been going spare trying to get round this, I can't seem to get the
> Asc() function to work in my script, but i can get it to work in other
> circumstances (when i use it as an argument or when I use it in a MsgBox.)

> I have tried using CStr etc to see if that makes any difference, It didn't.

> my code is below, its probably a stupid problem but I am going mental trying
> to get the sodding thing to work.

> Function Enc(sText)
> Dim j, k,r
> Do While j =< len(sText)
> k = k &left(sText, j)
> r = r & right(k, len(k) - (len(k)-1))
> j = j + 1
> Loop
> msgbox Asc(r)
> End Function
> This works, but i need it to convert each character to a value.

> Function Enc(sText)
> Dim j, k, r, o
> Do While j =< len(sText)
> k = k &left(sText, j)
> r = Asc(right(k, len(k) - (len(k)-1)))
> j = j + 1
> Loop
> Msgbox r
> End Function
> This doesn't work. I have tried other things but nothing seems to work
> right.

> THANKS

> Dominic Marks

Your logic escapes me.  I think you want the ASC of each character
concatenated in the variable 'r'.  I would do it something like this ...

Msgbox Enc("Sometext")

Function Enc(sText)
  Dim j,r
  For j = 1 to Len(sText)
    r = r & Asc(Mid(sText, j, 1))
  Next
  Enc = r
End Function

Is that what you're after?

Tom Lavedas
-----------
http://www.pressroom.com/~tglbatch/



Tue, 16 Jul 2002 03:00:00 GMT  
 I think I am going mental
quite possibly although i haven't checked, as for logic well it escapes me
too most of the time.

Thanks
Dominic Marks



Wed, 17 Jul 2002 03:00:00 GMT  
 I think I am going mental
You can now see what I was trying to do on the following url, this is now
the HTML incarnation. I have given up on the vbs based one for now.

http://www.fortunecity.co.uk/southbank/literature/437/



Wed, 17 Jul 2002 03:00:00 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. Going mental (Debugging)

2. Destructor: Am I thinking wrong?

3. Suggestions.......sorry - I am bored and thinking

4. Where am I going wrong ??!!

5. ** HELP WITH vb 4.0 I am going crazy**

6. Am I going insane...?

7. Am I going mad?

8. help i am going mad

9. Overflow - Am I going crazy?

10. Where am i going wrong??? ActiveX Control

11. PLEASE, PLEASE HELP, am I going MAD - Generating Totals

12. Am I going mad??

 

 
Powered by phpBB® Forum Software