|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
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 |
|
#2
|
|||
|
|||
|
bytpostdata is not defined
|
|
#3
|
|||
|
|||
|
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.
|
|
#4
|
||||
|
||||
|
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. |
![]() |
| Viewing: ASP Free Forums > Programming > Visual Basic Programming > This error is driving me crazy |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|