eladr
asked on
writing active x dll
see this very simple active x im trying to write:
Function getDataFromXor(cardID As Long, name As String, expirDate As Date, price As Integer) As String
'variable dcleration
Dim myData As String
'decleraing my other com object that get 4 parameters
Dim xorObj As New myXorObj.GetData
'saving the data into variable - just for future use
myData = cardID & "|" & name & "|" & expirDate & "|" & price
'insert parameters into the other active x
myXorObj.GetData(cardID As Long, name As String, expirDate As Date, price As Integer) As String
End Function
i always got : compile error: expected:list seperator or )
in this line:
myXorObj.GetData(cardID As Long, name As String, expirDate As Date, price As Integer) As String
Function getDataFromXor(cardID As Long, name As String, expirDate As Date, price As Integer) As String
'variable dcleration
Dim myData As String
'decleraing my other com object that get 4 parameters
Dim xorObj As New myXorObj.GetData
'saving the data into variable - just for future use
myData = cardID & "|" & name & "|" & expirDate & "|" & price
'insert parameters into the other active x
myXorObj.GetData(cardID As Long, name As String, expirDate As Date, price As Integer) As String
End Function
i always got : compile error: expected:list seperator or )
in this line:
myXorObj.GetData(cardID As Long, name As String, expirDate As Date, price As Integer) As String
GetData is a function of your myXorObj object? it should pass parameters like so:
Dim returnString As String
returnString = myXorObj.GetDate(cardID, name, expirDate, price)
it returns a string but i'm not sure where you want to store it or what you need to use it for.
Dim returnString As String
returnString = myXorObj.GetDate(cardID, name, expirDate, price)
it returns a string but i'm not sure where you want to store it or what you need to use it for.
ASKER
i got 2 dll.
one (as i posted the code) should get
4 parameters and insert them to the other com.
the "other com" is myXorObj
which has one function : getData.
i referenced to the object:
Dim xorObj As New myXorObj.GetData
but i got errors all the time in the line that insert the 4 parameters to the other com
elad
one (as i posted the code) should get
4 parameters and insert them to the other com.
the "other com" is myXorObj
which has one function : getData.
i referenced to the object:
Dim xorObj As New myXorObj.GetData
but i got errors all the time in the line that insert the 4 parameters to the other com
elad
ASKER
Function getDataFromXor(cardID As Long, name As String, expirDate As Date, price As Integer) As String
'variable dcleration
Dim myData As String
Dim myString As String
'decleraing my other com object that get 4 parameters
Dim xorObj As New myXorObj.GetData
'saving the data into variable - just for future use
myData = cardID & "|" & name & "|" & expirDate & "|" & price
'insert parameters into the other active x
myString = myXorObj.GetData(cardID, name, expirDate, price)
End Function
now i got method or data member not found
'variable dcleration
Dim myData As String
Dim myString As String
'decleraing my other com object that get 4 parameters
Dim xorObj As New myXorObj.GetData
'saving the data into variable - just for future use
myData = cardID & "|" & name & "|" & expirDate & "|" & price
'insert parameters into the other active x
myString = myXorObj.GetData(cardID, name, expirDate, price)
End Function
now i got method or data member not found
in this dll...have you referenced the other dll by going to project -> REFERENCES and checking it off?
also you declare the variable:
Dim xorObj As New myXorObj.GetData
is GetData the correct class name of that dll? is it also the name of the function?
even so, then you need to use the variable you declared:
myString = xorObj.GetData(cardID, name, expirDate, price)
also you declare the variable:
Dim xorObj As New myXorObj.GetData
is GetData the correct class name of that dll? is it also the name of the function?
even so, then you need to use the variable you declared:
myString = xorObj.GetData(cardID, name, expirDate, price)
GetDatafromXor = ReturnString surely
GetDatafromXor = MyData
ASKER
hi all...
i solved the problem.
now i have other one and for this one i will
post the points:
this is my simple com and everything works good.
<%
set xorObj = server.createObject("getDa taFromXor. getDataFro mXorClass" )
'com parameters
retuenAccess = xorObj.getDataFromXor("012 58528","el ad","3/2/0 0","45")
'answer from xor
response.write "Answer from xor:" & retuenAccess
%>
when im using variable instead of hard coded i got error:
<%
dim cardID
cardID="01258528"
set xorObj = server.createObject("getDa taFromXor. getDataFro mXorClass" )
'com parameters
retuenAccess = xorObj.getDataFromXor(card ID,"elad", "3/2/00"," 45")
'answer from xor
response.write "Answer from xor:" & retuenAccess
%>
Microsoft VBScript runtime error '800a000d'
Type mismatch: 'getDataFromXor'
/xor/xor.asp, line 18
i solved the problem.
now i have other one and for this one i will
post the points:
this is my simple com and everything works good.
<%
set xorObj = server.createObject("getDa
'com parameters
retuenAccess = xorObj.getDataFromXor("012
'answer from xor
response.write "Answer from xor:" & retuenAccess
%>
when im using variable instead of hard coded i got error:
<%
dim cardID
cardID="01258528"
set xorObj = server.createObject("getDa
'com parameters
retuenAccess = xorObj.getDataFromXor(card
'answer from xor
response.write "Answer from xor:" & retuenAccess
%>
Microsoft VBScript runtime error '800a000d'
Type mismatch: 'getDataFromXor'
/xor/xor.asp, line 18
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
i will give it a try...
elad
elad
You could also try
retuenAccess = xorObj.getDataFromXor(clng (cardID)," elad","3/2 /00","45")
Similarly for other variables do the conversion to the correct datatype required for the DLL and then call the function.
retuenAccess = xorObj.getDataFromXor(clng (cardID),C str(String Variable), CDate(Date Variable), Cint(Integ erVariable ))
retuenAccess = xorObj.getDataFromXor(clng
Similarly for other variables do the conversion to the correct datatype required for the DLL and then call the function.
retuenAccess = xorObj.getDataFromXor(clng
ASKER
i tried hithere solution:
mystring = xorObj.GetData (ByVal cardID As Long,byVal name as String,byVal expirDate As Date,byVal price As Integer) As String
but i got compile error-syntax error
mystring = xorObj.GetData (ByVal cardID As Long,byVal name as String,byVal expirDate As Date,byVal price As Integer) As String
but i got compile error-syntax error
ASKER
i tried manoj_r solution and it's works.
but i prefer inside dll function solution
eladr
but i prefer inside dll function solution
eladr
Both manoj_r and hithere solution should work for you.
You can change function to
e.g. getDataFromXor(cardID As Variant, name As Variant, expirDate As Variant, price As Variant)
8->
You can change function to
e.g. getDataFromXor(cardID As Variant, name As Variant, expirDate As Variant, price As Variant)
8->
As HiThere has mentioned you have to change the function defination in VB. Replace your function declaration fro getDataFromXor with
(ByVal cardID As Long,byVal name as String,byVal expirDate As Date,byVal price As Integer) As String
abd from your asp page call it as
mystring = xorObj.GetData (cardID ,name ,expirDate,price)
(ByVal cardID As Long,byVal name as String,byVal expirDate As Date,byVal price As Integer) As String
abd from your asp page call it as
mystring = xorObj.GetData (cardID ,name ,expirDate,price)
ASKER
HEY...
I think i missing something here...
im always got syntax error!
this is my function...
the error is on the line :
mystring = xorObj.GetData(cardID As Variant, name As Variant, expirDate As Variant, price As Variant)
Function getDataFromXor(cardID As Long, name As String, expirDate As Date, price As Integer) As String
'variable dcleration
Dim myData As String
Dim mystring As String
'decleraing my other com object that get 4 parameters
Dim xorObj As Object
'insert parameters into the other active x
Set xorObj = CreateObject("myXorObj.myX orObjclass ")
mystring = xorObj.GetData(cardID As Variant, name As Variant, expirDate As Variant, price As Variant)
getDataFromXor = mystring
End Function
I think i missing something here...
im always got syntax error!
this is my function...
the error is on the line :
mystring = xorObj.GetData(cardID As Variant, name As Variant, expirDate As Variant, price As Variant)
Function getDataFromXor(cardID As Long, name As String, expirDate As Date, price As Integer) As String
'variable dcleration
Dim myData As String
Dim mystring As String
'decleraing my other com object that get 4 parameters
Dim xorObj As Object
'insert parameters into the other active x
Set xorObj = CreateObject("myXorObj.myX
mystring = xorObj.GetData(cardID As Variant, name As Variant, expirDate As Variant, price As Variant)
getDataFromXor = mystring
End Function
ASKER
got it...got it...
i should do the byVal in the top define function...
correct?
elad
i should do the byVal in the top define function...
correct?
elad
Correct !
I hope this will work
Function getDataFromXor(ByRef cardID As Variant, _
ByRef name As Variant, _
ByRef expirDate As Variant, _
ByRef price As Variant) As String
'variable dcleration
Dim myData As String
Dim mystring As String
'decleraing my other com object that get 4 parameters
Dim xorObj As Object
Dim lCardID As Long
Dim strName As String
Dim dtExpirDate As Date
Dim mPrice As Integer
lCardID = cardID
strName = name
dtExpirDate = expirDate
mPrice = price
'insert parameters into the other active x
Set xorObj = CreateObject("myXorObj.myX orObjclass ")
mystring = xorObj.GetData(lCardID, strName, dtExpirDate, mPrice)
getDataFromXor = mystring
End Function
Function GetData(ByRef ICardID As Long, _
ByRef name As String, _
ByRef expirDate As Date, _
ByRef price As Integer) As String
'your code
End Function
Function getDataFromXor(ByRef cardID As Variant, _
ByRef name As Variant, _
ByRef expirDate As Variant, _
ByRef price As Variant) As String
'variable dcleration
Dim myData As String
Dim mystring As String
'decleraing my other com object that get 4 parameters
Dim xorObj As Object
Dim lCardID As Long
Dim strName As String
Dim dtExpirDate As Date
Dim mPrice As Integer
lCardID = cardID
strName = name
dtExpirDate = expirDate
mPrice = price
'insert parameters into the other active x
Set xorObj = CreateObject("myXorObj.myX
mystring = xorObj.GetData(lCardID, strName, dtExpirDate, mPrice)
getDataFromXor = mystring
End Function
Function GetData(ByRef ICardID As Long, _
ByRef name As String, _
ByRef expirDate As Date, _
ByRef price As Integer) As String
'your code
End Function
What's going on with this question.
Surely fbtcell and azrasound answered it already.
You can't put:-
myXorObj.GetData(cardID As Long, name As String, expirDate As Date, price As Integer) As String
in the middle of a function. This looks more like a function declarartion as opposed to a function call.
Surely fbtcell and azrasound answered it already.
You can't put:-
myXorObj.GetData(cardID As Long, name As String, expirDate As Date, price As Integer) As String
in the middle of a function. This looks more like a function declarartion as opposed to a function call.
ASKER
sorry dave_b
u right but many others already answered
this!
u right but many others already answered
this!
ASKER
im closing the que.
hithere will get all points.
i will post new que. with 10 points to manoj_r also.
i want to thank you all for helping me so much.
eladr
hithere will get all points.
i will post new que. with 10 points to manoj_r also.
i want to thank you all for helping me so much.
eladr
ASKER
thanks again...
Dim myString as String
....
myString = myXorObj.GetData(cardID, name, expirDate, price)