Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > Pro VB 6
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Pro VB 6 For advanced Visual Basic coders working in version 6 (not .NET). Beginning-level questions will be redirected to other forums, including Beginning VB 6.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Pro VB 6 section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old March 18th, 2009, 04:01 AM
Ivy Ivy is offline
Registered User
 
Join Date: Mar 2009
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default Visual Basic 6.0

I have problem when running the application written in VB6 in certain PC. Runtime error 5 - Invalid Procedure or Argument call.

The code as below:

passval = "123456"
chrpass = ""
for i = 1 to 6
chrpass = chrpass + chr(asc(passval,i,1))
next

stringpass = "xxxxxx..." ' 80 character in this stringpass
len_str = len(stringpass)

int_mod = Modulus(len_str, 6)
chrtoread = 1
X = 1

For cycle = 1 To Int(len_str / 6)
For intbyte = 1 To 6
sal_read = Ebcdic(Mid(stringpass, chrtoread, 1)) '-->user-defined function, no error
pw_read = Asc(Mid(chrpass, intbyte, 1)) '-->suspect error occurred here
EOr_Read = Int(sal_read) Xor Int(pw_read)
EOrPass = EOrPass + Chr(EOr_Read)
chrtoread = chrtoread + 1
Next
Next

Any idea to solve this??
Reply With Quote
  #2 (permalink)  
Old March 18th, 2009, 04:38 AM
Friend of Wrox
Points: 3,060, Level: 23
Points: 3,060, Level: 23 Points: 3,060, Level: 23 Points: 3,060, Level: 23
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Sep 2005
Location: , , .
Posts: 812
Thanks: 1
Thanked 53 Times in 49 Posts
Default

The ASC Function you have used accepts only one arguments

For example

asc("a") - 97

also check if you need the following

Chr(Asc(passval))

Cheers
Shasur
__________________
C# Code Snippets (http://www.dotnetdud.blogspot.com)

VBA Tips & Tricks (http://www.vbadud.blogspot.com)
Reply With Quote
  #3 (permalink)  
Old March 18th, 2009, 05:19 AM
Ivy Ivy is offline
Registered User
 
Join Date: Mar 2009
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

The ASC function at the begining OK!..

The error occured at the bottom ASC function I guest. only few PC encounter this.

Anyone know which dll called for ASC() / mid()?
Reply With Quote
  #4 (permalink)  
Old March 18th, 2009, 05:35 AM
Friend of Wrox
Points: 3,060, Level: 23
Points: 3,060, Level: 23 Points: 3,060, Level: 23 Points: 3,060, Level: 23
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Sep 2005
Location: , , .
Posts: 812
Thanks: 1
Thanked 53 Times in 49 Posts
Default

Both are part of MSVBVM60.DLL

cheers
Shasur
__________________
C# Code Snippets (http://www.dotnetdud.blogspot.com)

VBA Tips & Tricks (http://www.vbadud.blogspot.com)
Reply With Quote
  #5 (permalink)  
Old March 18th, 2009, 07:49 AM
Friend of Wrox
Points: 7,395, Level: 36
Points: 7,395, Level: 36 Points: 7,395, Level: 36 Points: 7,395, Level: 36
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Capital Federal, , Argentina.
Posts: 2,189
Thanks: 5
Thanked 59 Times in 57 Posts
Send a message via MSN to gbianchi
Default

Hi there.. just to be sure, can you just put an on error at top, use option explicit to gave types to your variables, and also at the error throw out the error line??? to do that, just put a line number at the beggining of each line (like 10:, 20:, etc.) and at the error just printout erl (which has the error tag, in this case a number).

Also all this function smell very fishy.. You are just encriptyng something that will return always the same value, besides that you are doing a lot of for...next that are totally unnecesary.
__________________
HTH

Gonzalo


================================================== =========
Read this if you want to know how to get a correct reply for your question.
(Took that from Doug signature and he Took that from Peter profile)
================================================== =========
My programs achieved a new certification :
WORKS ON MY MACHINE
================================================== =========
I know that CVS was evil, and now i got the
proof.
================================================== =========
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Visual Basic monika.vasvani VB Databases Basics 5 June 16th, 2014 10:01 AM
visual basic 6.0 flowertear Pro VB 6 3 June 28th, 2013 03:16 PM
Visual Basic sandeepgreaternoida Visual Basic 2005 Basics 2 January 12th, 2009 03:40 AM
FTP in Visual Studio 2005 Pro (Visual Basic) shoopes VB How-To 1 June 29th, 2006 02:08 PM
Visual Basic 6.0 Danielvb VB How-To 1 June 9th, 2003 04:30 PM



All times are GMT -4. The time now is 12:39 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.