Visual Basic .NET » Smart Device Application
Problem with incompatible types and API Call (Argument matching parameter 'parameter' cannot convert from 'Type' to 'Type()' -- BradleyPeter --

You second parameter looks wrong. I guess you need to drop the parentheses. Is there a good reason for them being there?
Peter
-----Original Message-----
From: DotNetDevelopment on behalf of jmoore1999 Sent: Wed 7/12/2006 4:10 PM To: DotNetDevelopment, VB.NET, C# .NET, ADO.NET, ASP.NET, XML, XML Web Services,.NET Remoting Cc:
Subject:
Problem with incompatible types and API Call (Argument matching parameter 'parameter' cannot convert from 'Type' to 'Type()'
I am trying to use an api for a list manager program to perform what i thought would be a fairly easy task of updating user information. I am fairly new at asp.net so i will thank you in advance for your patience.

The API method is called UpdateMemberDemographics and requires the two parameters, simpleMemberStruct and KeyValueType. The List Managment program has documentation for each of these at the following location.
(
http://lyris.com/help/lm_api/9.0 
/)

When i try to run the code below i receive the following error:
--------------------------------------------------------------------------------------------------------------------------------------------------
Method invocation failed because 'Public Function UpdateMemberDemographics(SimpleMemberStructIn As lmapiSoap.SimpleMemberStruct, DemographicsArray As lmapiSoap.KeyValueType()) As Boolean' cannot be called with these arguments: Argument matching parameter 'DemographicsArray' cannot convert from 'KeyValueType' to 'KeyValueType()'.
--------------------------------------------------------------------------------------------------------------------------------------------------

Dim lm = New lmapi()
Dim lmUsername As String = "adminUsername"
Dim lmPassword As String = "adminPassword"
lm.Credentials = New NetworkCredential(lmUsername, lmPassword)

If lm.ApiVersion() <> "1.5 beta" Then
Response.Write("Incorrect API Version! :" +
lm.ApiVersion())
End If

Dim keyvaluetypes As New lmapiSoap.KeyValueType()
keyvaluetypes.Name = "Field Name to Modify"
keyvaluetypes.Value = "New Value for Field"

Dim simpleMember As New SimpleMemberStruct()
simpleMember.ListName = "listname"
simpleMember.EmailAddress = "email"

lm.UpdateMemberDemographics(simpleMember, keyvaluetypes)
--------------------------------------------------------------------------------------------------------------------------------------------------

I assume the problem is that the object i create using the keyValueType type is not in the array form and the parameter should be. One thing i have yet to completely grasp is the difference between a "keyValueType"
and "keyValueType()" or for that matter any custom "type" and the
"type()" counterpart. An explination of this fundamental would be greatly appreciated.
Thanks in advance and let me know if you need more information.
Thanks Jeremy



[Submit Comment]Home