Visual Basic Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsProgrammingVisual Basic Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old January 17th, 2007, 04:07 AM
iglobal iglobal is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Aug 2006
Posts: 8 iglobal User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 10 m 41 sec
Reputation Power: 0
This error is driving me crazy

Hello,

I've been trying to figure out the cause of this error but
have not been able to.


VB6 Code:

Code:
Private Sub BuildPostData(ByteArray() As Byte, ByVal strPostData As String)
    Dim intNewBytes As Integer
    Dim strCH As String
    Dim i As Integer
    
    intNewBytes = Len(strPostData) - 1
    
    If intNewBytes < 0 Then
     Exit Sub
    End If
    
    ReDim ByteArray(intNewBytes)
    
    For i = 0 To intNewBytes
     strCH = Mid$(strPostData, i + 1, 1)
     
     If strCH = Space(1) Then
        strCH = "+"
     End If
     
     ByteArray(i) = Asc(strCH)
    Next
End Sub

Private Sub Command1_Click()
    Dim strPostData As String
    Dim strHeader As String
    Dim varPostData As Variant
        
    'Make the Post Data String
    strPostData = "Name1=Value1&Name2=Value2"
    
    'Pack the post data into a byte array
    BuildPostData bytpostdata(), strPostData
    
    'Write the byte into a variant
    varPostData = bytpostdata
    
    'Create the Header
    strHeader = "Content-Type: application/x-www-form-urlencoded" + Chr(10) + Chr(13)
    
    'Post the data
    Web.Navigate2 "http://mysite.com", 0, "", varPostData, strHeader
End Sub



I get the error Sub or Function not defined on "BuildPostData bytpostdata(), strPostData".

This is actually sample code i got from http://abstractvb.com/code.asp?A=948

Any suggestion will be appreciated.

Cheers,
John

Reply With Quote
  #2  
Old January 17th, 2007, 10:28 AM
Darius Darius is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Sep 2004
Posts: 108 Darius User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 11 h 16 m 54 sec
Reputation Power: 5
bytpostdata is not defined

Reply With Quote
  #3  
Old January 18th, 2007, 12:14 AM
Alias-Zero Alias-Zero is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Sep 2005
Location: localhost
Posts: 40 Alias-Zero User rank is Lance Corporal (50 - 100 Reputation Level)Alias-Zero User rank is Lance Corporal (50 - 100 Reputation Level)Alias-Zero User rank is Lance Corporal (50 - 100 Reputation Level) 
Time spent in forums: 14 h 44 m 12 sec
Reputation Power: 4
Send a message via ICQ to Alias-Zero Send a message via AIM to Alias-Zero Send a message via MSN to Alias-Zero Send a message via Yahoo to Alias-Zero
Yep, I agree with the above poster. You're passing an array, bytpostdata, to the sub BuildPostData, but that array doesn't appear to exist in your code.

Reply With Quote
  #4  
Old January 18th, 2007, 01:42 AM
Shadow Wizard's Avatar
Shadow Wizard Shadow Wizard is offline
Moderator From Beyond
ASP Free God 46th Plane (27500 - 27999 posts)
 
Join Date: Sep 2004
Location: Israel
Posts: 27,932 Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)  Folding Points: 391471 Folding Title: Super Ultimate Folder - Level 1Folding Points: 391471 Folding Title: Super Ultimate Folder - Level 1Folding Points: 391471 Folding Title: Super Ultimate Folder - Level 1Folding Points: 391471 Folding Title: Super Ultimate Folder - Level 1Folding Points: 391471 Folding Title: Super Ultimate Folder - Level 1Folding Points: 391471 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 3 Months 2 Weeks 12 h 17 m 53 sec
Reputation Power: 2002
well, probably whoever wrote this code does not have to
declare his variables. this is BAD programming practice.
anyway, as others have said here you have to declare
the variable bytpostdata in order to avoid that error
you get.

Reply With Quote
Reply

Viewing: ASP Free ForumsProgrammingVisual Basic Programming > This error is driving me crazy


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump



 Free IT White Papers!
 
How to Present Effectively Online
This white paper offers practical and actionable advice on the key steps that any presenter should consider as they plan and execute a Webinar or online meeting.

 
Open Source Security Myths
Open Source Software (OSS) is computer software whose source code is available to the general public with relaxed or non-existent intellectual property restrictions (or arrangement such as the public domain), and is usually developed with the input of many contributors.

 
Power and Cooling Capacity Management for Data Centers
This paper describes the principles for achieving power and cooling capacity management.

 
Scalable, Fault-Tolerant NAS for Oracle - The Next Generation
For several years NAS has been evolving as a storage alternative for Oracle databases, and for good reason: NAS is quite often the simplest, most cost-effective storage approach for Oracle. Learn about the benefits that HP's approach to scalable NAS brings to Oracle environments in this comprehensive white paper.

 
Understanding Web Application Security Challenges
This white paper discusses many common threats and preventive measures for Web application security, and explains what you can do to help protect your organization.

 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2009 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway
Stay green...Green IT