OCRWS_Language[] langs = { OCRWS_Language.ENGLISH, OCRWS_Language.GERMAN };
And this is the information from the .net Relector
I cannot for the life of me figure out how to set these values in VFP. Can anyone help me with this?
EDIT: I cannot post an image here. Any tips on how to do that?
Enums are a bit tricky in VFP because VFP has no concept of them natively and it's doubly complicated for Arrays because of the strict typing requirement.
There are several ways to do this but the cleanes is to use the ComValue class to assign the Enum value and then assign it to a ComArray.
The following example demonstrates:
do wwDotNetBridge
LOCAL loBridge as wwDotNetBridge
loBridge = CreateObject("wwDotNetBridge","V4")
loBridge.LoadAssembly("System.Windows.Forms")loTest = loBridge.CreateInstance("Westwind.WebConnection.TypePassingTests")
*** Create the array of the proper type
LOCAL loArray as Westwind.WebConnection.ComArray
loArray = loBridge.Createarray("System.Windows.Forms.MessageBoxButtons")*** Add each of the enum values as a ComValue
loComValue = loBridge.CreateComValue()
loComValue.SetEnum("System.Windows.Forms.MessageBoxButtons.OK")
loArray.AddItem( loComValue)loComValue = loBridge.CreateComValue()
loComValue.SetEnum("System.Windows.Forms.MessageBoxButtons.OKCancel")
loArray.AddItem( loComValue)loComValue = loBridge.CreateComValue()
loComValue.SetEnum("System.Windows.Forms.MessageBoxButtons.YesNo")
loArray.AddItem( loComValue)*** Use InvokeMethod to pass the ComArray
? loBridge.InvokeMethod(loTest,"PassEnumArray",loArray)
? loArray.Count()RETURN
+++ Rick ---
The following works fine in c#
OCRWS_Language[] langs = { OCRWS_Language.ENGLISH, OCRWS_Language.GERMAN };
And this is the information from the .net Relector
I cannot for the life of me figure out how to set these values in VFP. Can anyone help me with this?
EDIT: I cannot post an image here. Any tips on how to do that?
West Wind Technologies
Making waves on the Web
from Maui
Thanks, Rick, but when I get to the AddItem method I get the error "Object cannot be stored in an array of this type"
Hi Lyn,
Enums are a bit tricky in VFP because VFP has no concept of them natively and it's doubly complicated for Arrays because of the strict typing requirement.
There are several ways to do this but the cleanes is to use the ComValue class to assign the Enum value and then assign it to a ComArray.
The following example demonstrates:
do wwDotNetBridge
LOCAL loBridge as wwDotNetBridge
loBridge = CreateObject("wwDotNetBridge","V4")
loBridge.LoadAssembly("System.Windows.Forms")loTest = loBridge.CreateInstance("Westwind.WebConnection.TypePassingTests")
*** Create the array of the proper type
LOCAL loArray as Westwind.WebConnection.ComArray
loArray = loBridge.Createarray("System.Windows.Forms.MessageBoxButtons")*** Add each of the enum values as a ComValue
loComValue = loBridge.CreateComValue()
loComValue.SetEnum("System.Windows.Forms.MessageBoxButtons.OK")
loArray.AddItem( loComValue)loComValue = loBridge.CreateComValue()
loComValue.SetEnum("System.Windows.Forms.MessageBoxButtons.OKCancel")
loArray.AddItem( loComValue)loComValue = loBridge.CreateComValue()
loComValue.SetEnum("System.Windows.Forms.MessageBoxButtons.YesNo")
loArray.AddItem( loComValue)*** Use InvokeMethod to pass the ComArray
? loBridge.InvokeMethod(loTest,"PassEnumArray",loArray)
? loArray.Count()RETURN
+++ Rick ---
The following works fine in c#
OCRWS_Language[] langs = { OCRWS_Language.ENGLISH, OCRWS_Language.GERMAN };
And this is the information from the .net Relector
I cannot for the life of me figure out how to set these values in VFP. Can anyone help me with this?
EDIT: I cannot post an image here. Any tips on how to do that?
Make sure the type name is correct when you declare the array.
+++ Rick ---
Thanks, Rick, but when I get to the AddItem method I get the error "Object cannot be stored in an array of this type"
Hi Lyn,
Enums are a bit tricky in VFP because VFP has no concept of them natively and it's doubly complicated for Arrays because of the strict typing requirement.
There are several ways to do this but the cleanes is to use the ComValue class to assign the Enum value and then assign it to a ComArray.
The following example demonstrates:
do wwDotNetBridge
LOCAL loBridge as wwDotNetBridge
loBridge = CreateObject("wwDotNetBridge","V4")
loBridge.LoadAssembly("System.Windows.Forms")loTest = loBridge.CreateInstance("Westwind.WebConnection.TypePassingTests")
*** Create the array of the proper type
LOCAL loArray as Westwind.WebConnection.ComArray
loArray = loBridge.Createarray("System.Windows.Forms.MessageBoxButtons")*** Add each of the enum values as a ComValue
loComValue = loBridge.CreateComValue()
loComValue.SetEnum("System.Windows.Forms.MessageBoxButtons.OK")
loArray.AddItem( loComValue)loComValue = loBridge.CreateComValue()
loComValue.SetEnum("System.Windows.Forms.MessageBoxButtons.OKCancel")
loArray.AddItem( loComValue)loComValue = loBridge.CreateComValue()
loComValue.SetEnum("System.Windows.Forms.MessageBoxButtons.YesNo")
loArray.AddItem( loComValue)*** Use InvokeMethod to pass the ComArray
? loBridge.InvokeMethod(loTest,"PassEnumArray",loArray)
? loArray.Count()RETURN
+++ Rick ---
The following works fine in c#
OCRWS_Language[] langs = { OCRWS_Language.ENGLISH, OCRWS_Language.GERMAN };
And this is the information from the .net Relector
I cannot for the life of me figure out how to set these values in VFP. Can anyone help me with this?
EDIT: I cannot post an image here. Any tips on how to do that?
West Wind Technologies
Making waves on the Web
from Maui
public enum OCRWS_Language
Name: OCRWebService.OCRWS_Language
Assembly: OCRWebServiceProxy, Version=0.0.0.0
This is the code I used:
LOCAL loArray as Westwind.WebConnection.ComArray
loArray = oBridge.CreateArray("OCRWebService.OCRWS_Language")
loComValue = oBridge.CreateComValue()
loComValue.SetEnum("OCRWebService.OCRWS_Language.ENGLISH")
loArray.AddItem(loComValue)
Make sure the type name is correct when you declare the array.
+++ Rick ---
Thanks, Rick, but when I get to the AddItem method I get the error "Object cannot be stored in an array of this type"
Hi Lyn,
Enums are a bit tricky in VFP because VFP has no concept of them natively and it's doubly complicated for Arrays because of the strict typing requirement.
There are several ways to do this but the cleanes is to use the ComValue class to assign the Enum value and then assign it to a ComArray.
The following example demonstrates:
do wwDotNetBridge
LOCAL loBridge as wwDotNetBridge
loBridge = CreateObject("wwDotNetBridge","V4")
loBridge.LoadAssembly("System.Windows.Forms")loTest = loBridge.CreateInstance("Westwind.WebConnection.TypePassingTests")
*** Create the array of the proper type
LOCAL loArray as Westwind.WebConnection.ComArray
loArray = loBridge.Createarray("System.Windows.Forms.MessageBoxButtons")*** Add each of the enum values as a ComValue
loComValue = loBridge.CreateComValue()
loComValue.SetEnum("System.Windows.Forms.MessageBoxButtons.OK")
loArray.AddItem( loComValue)loComValue = loBridge.CreateComValue()
loComValue.SetEnum("System.Windows.Forms.MessageBoxButtons.OKCancel")
loArray.AddItem( loComValue)loComValue = loBridge.CreateComValue()
loComValue.SetEnum("System.Windows.Forms.MessageBoxButtons.YesNo")
loArray.AddItem( loComValue)*** Use InvokeMethod to pass the ComArray
? loBridge.InvokeMethod(loTest,"PassEnumArray",loArray)
? loArray.Count()RETURN
+++ Rick ---
The following works fine in c#
OCRWS_Language[] langs = { OCRWS_Language.ENGLISH, OCRWS_Language.GERMAN };
And this is the information from the .net Relector
I cannot for the life of me figure out how to set these values in VFP. Can anyone help me with this?
EDIT: I cannot post an image here. Any tips on how to do that?
Don't know then... that should work unless the type is not really an enum. Also make sure you have the latest version.
Can you run the code sample code I sent you? (the final method call won't work but everything up to there should). Just put it into a PRG file and run. Does that work up to that final method?
+++ Rick ---
I copied it from the .NET reflector:
public enum OCRWS_Language
Name: OCRWebService.OCRWS_Language
Assembly: OCRWebServiceProxy, Version=0.0.0.0
This is the code I used:
LOCAL loArray as Westwind.WebConnection.ComArray
loArray = oBridge.CreateArray("OCRWebService.OCRWS_Language")
loComValue = oBridge.CreateComValue()
loComValue.SetEnum("OCRWebService.OCRWS_Language.ENGLISH")
loArray.AddItem(loComValue)
Make sure the type name is correct when you declare the array.
+++ Rick ---
Thanks, Rick, but when I get to the AddItem method I get the error "Object cannot be stored in an array of this type"
Hi Lyn,
Enums are a bit tricky in VFP because VFP has no concept of them natively and it's doubly complicated for Arrays because of the strict typing requirement.
There are several ways to do this but the cleanes is to use the ComValue class to assign the Enum value and then assign it to a ComArray.
The following example demonstrates:
do wwDotNetBridge
LOCAL loBridge as wwDotNetBridge
loBridge = CreateObject("wwDotNetBridge","V4")
loBridge.LoadAssembly("System.Windows.Forms")loTest = loBridge.CreateInstance("Westwind.WebConnection.TypePassingTests")
*** Create the array of the proper type
LOCAL loArray as Westwind.WebConnection.ComArray
loArray = loBridge.Createarray("System.Windows.Forms.MessageBoxButtons")*** Add each of the enum values as a ComValue
loComValue = loBridge.CreateComValue()
loComValue.SetEnum("System.Windows.Forms.MessageBoxButtons.OK")
loArray.AddItem( loComValue)loComValue = loBridge.CreateComValue()
loComValue.SetEnum("System.Windows.Forms.MessageBoxButtons.OKCancel")
loArray.AddItem( loComValue)loComValue = loBridge.CreateComValue()
loComValue.SetEnum("System.Windows.Forms.MessageBoxButtons.YesNo")
loArray.AddItem( loComValue)*** Use InvokeMethod to pass the ComArray
? loBridge.InvokeMethod(loTest,"PassEnumArray",loArray)
? loArray.Count()RETURN
+++ Rick ---
The following works fine in c#
OCRWS_Language[] langs = { OCRWS_Language.ENGLISH, OCRWS_Language.GERMAN };
And this is the information from the .net Relector
I cannot for the life of me figure out how to set these values in VFP. Can anyone help me with this?
EDIT: I cannot post an image here. Any tips on how to do that?
West Wind Technologies
Making waves on the Web
from Maui
Don't know then... that should work unless the type is not really an enum. Also make sure you have the latest version.
Can you run the code sample code I sent you? (the final method call won't work but everything up to there should). Just put it into a PRG file and run. Does that work up to that final method?
+++ Rick ---
I copied it from the .NET reflector:
public enum OCRWS_Language
Name: OCRWebService.OCRWS_Language
Assembly: OCRWebServiceProxy, Version=0.0.0.0
This is the code I used:
LOCAL loArray as Westwind.WebConnection.ComArray
loArray = oBridge.CreateArray("OCRWebService.OCRWS_Language")
loComValue = oBridge.CreateComValue()
loComValue.SetEnum("OCRWebService.OCRWS_Language.ENGLISH")
loArray.AddItem(loComValue)
Make sure the type name is correct when you declare the array.
+++ Rick ---
Thanks, Rick, but when I get to the AddItem method I get the error "Object cannot be stored in an array of this type"
Hi Lyn,
Enums are a bit tricky in VFP because VFP has no concept of them natively and it's doubly complicated for Arrays because of the strict typing requirement.
There are several ways to do this but the cleanes is to use the ComValue class to assign the Enum value and then assign it to a ComArray.
The following example demonstrates:
do wwDotNetBridge
LOCAL loBridge as wwDotNetBridge
loBridge = CreateObject("wwDotNetBridge","V4")
loBridge.LoadAssembly("System.Windows.Forms")loTest = loBridge.CreateInstance("Westwind.WebConnection.TypePassingTests")
*** Create the array of the proper type
LOCAL loArray as Westwind.WebConnection.ComArray
loArray = loBridge.Createarray("System.Windows.Forms.MessageBoxButtons")*** Add each of the enum values as a ComValue
loComValue = loBridge.CreateComValue()
loComValue.SetEnum("System.Windows.Forms.MessageBoxButtons.OK")
loArray.AddItem( loComValue)loComValue = loBridge.CreateComValue()
loComValue.SetEnum("System.Windows.Forms.MessageBoxButtons.OKCancel")
loArray.AddItem( loComValue)loComValue = loBridge.CreateComValue()
loComValue.SetEnum("System.Windows.Forms.MessageBoxButtons.YesNo")
loArray.AddItem( loComValue)*** Use InvokeMethod to pass the ComArray
? loBridge.InvokeMethod(loTest,"PassEnumArray",loArray)
? loArray.Count()RETURN
+++ Rick ---
The following works fine in c#
OCRWS_Language[] langs = { OCRWS_Language.ENGLISH, OCRWS_Language.GERMAN };
And this is the information from the .net Relector
I cannot for the life of me figure out how to set these values in VFP. Can anyone help me with this?
EDIT: I cannot post an image here. Any tips on how to do that?
Also try this in the sample code:
loComValue.SetEnum("System.Windows.Forms.MessageBoxButtons.YesNo")
? loComValue.Value
This should show a numeric value of some sort.
+++ Rick ---
I get the same error with the test code you sent.
Don't know then... that should work unless the type is not really an enum. Also make sure you have the latest version.
Can you run the code sample code I sent you? (the final method call won't work but everything up to there should). Just put it into a PRG file and run. Does that work up to that final method?
+++ Rick ---
I copied it from the .NET reflector:
public enum OCRWS_Language
Name: OCRWebService.OCRWS_Language
Assembly: OCRWebServiceProxy, Version=0.0.0.0
This is the code I used:
LOCAL loArray as Westwind.WebConnection.ComArray
loArray = oBridge.CreateArray("OCRWebService.OCRWS_Language")
loComValue = oBridge.CreateComValue()
loComValue.SetEnum("OCRWebService.OCRWS_Language.ENGLISH")
loArray.AddItem(loComValue)
Make sure the type name is correct when you declare the array.
+++ Rick ---
Thanks, Rick, but when I get to the AddItem method I get the error "Object cannot be stored in an array of this type"
Hi Lyn,
Enums are a bit tricky in VFP because VFP has no concept of them natively and it's doubly complicated for Arrays because of the strict typing requirement.
There are several ways to do this but the cleanes is to use the ComValue class to assign the Enum value and then assign it to a ComArray.
The following example demonstrates:
do wwDotNetBridge
LOCAL loBridge as wwDotNetBridge
loBridge = CreateObject("wwDotNetBridge","V4")
loBridge.LoadAssembly("System.Windows.Forms")loTest = loBridge.CreateInstance("Westwind.WebConnection.TypePassingTests")
*** Create the array of the proper type
LOCAL loArray as Westwind.WebConnection.ComArray
loArray = loBridge.Createarray("System.Windows.Forms.MessageBoxButtons")*** Add each of the enum values as a ComValue
loComValue = loBridge.CreateComValue()
loComValue.SetEnum("System.Windows.Forms.MessageBoxButtons.OK")
loArray.AddItem( loComValue)loComValue = loBridge.CreateComValue()
loComValue.SetEnum("System.Windows.Forms.MessageBoxButtons.OKCancel")
loArray.AddItem( loComValue)loComValue = loBridge.CreateComValue()
loComValue.SetEnum("System.Windows.Forms.MessageBoxButtons.YesNo")
loArray.AddItem( loComValue)*** Use InvokeMethod to pass the ComArray
? loBridge.InvokeMethod(loTest,"PassEnumArray",loArray)
? loArray.Count()RETURN
+++ Rick ---
The following works fine in c#
OCRWS_Language[] langs = { OCRWS_Language.ENGLISH, OCRWS_Language.GERMAN };
And this is the information from the .net Relector
I cannot for the life of me figure out how to set these values in VFP. Can anyone help me with this?
EDIT: I cannot post an image here. Any tips on how to do that?
West Wind Technologies
Making waves on the Web
from Hood River
I just bought the Proxy Generator about 5 months ago. How do I get the latest version?
Make sure you have the latest version of the tool. This code might have been updated recently...
Also try this in the sample code:
loComValue.SetEnum("System.Windows.Forms.MessageBoxButtons.YesNo")
? loComValue.Value
This should show a numeric value of some sort.
+++ Rick ---
I get the same error with the test code you sent.
Don't know then... that should work unless the type is not really an enum. Also make sure you have the latest version.
Can you run the code sample code I sent you? (the final method call won't work but everything up to there should). Just put it into a PRG file and run. Does that work up to that final method?
+++ Rick ---
I copied it from the .NET reflector:
public enum OCRWS_Language
Name: OCRWebService.OCRWS_Language
Assembly: OCRWebServiceProxy, Version=0.0.0.0
This is the code I used:
LOCAL loArray as Westwind.WebConnection.ComArray
loArray = oBridge.CreateArray("OCRWebService.OCRWS_Language")
loComValue = oBridge.CreateComValue()
loComValue.SetEnum("OCRWebService.OCRWS_Language.ENGLISH")
loArray.AddItem(loComValue)
Make sure the type name is correct when you declare the array.
+++ Rick ---
Thanks, Rick, but when I get to the AddItem method I get the error "Object cannot be stored in an array of this type"
Hi Lyn,
Enums are a bit tricky in VFP because VFP has no concept of them natively and it's doubly complicated for Arrays because of the strict typing requirement.
There are several ways to do this but the cleanes is to use the ComValue class to assign the Enum value and then assign it to a ComArray.
The following example demonstrates:
do wwDotNetBridge
LOCAL loBridge as wwDotNetBridge
loBridge = CreateObject("wwDotNetBridge","V4")
loBridge.LoadAssembly("System.Windows.Forms")loTest = loBridge.CreateInstance("Westwind.WebConnection.TypePassingTests")
*** Create the array of the proper type
LOCAL loArray as Westwind.WebConnection.ComArray
loArray = loBridge.Createarray("System.Windows.Forms.MessageBoxButtons")*** Add each of the enum values as a ComValue
loComValue = loBridge.CreateComValue()
loComValue.SetEnum("System.Windows.Forms.MessageBoxButtons.OK")
loArray.AddItem( loComValue)loComValue = loBridge.CreateComValue()
loComValue.SetEnum("System.Windows.Forms.MessageBoxButtons.OKCancel")
loArray.AddItem( loComValue)loComValue = loBridge.CreateComValue()
loComValue.SetEnum("System.Windows.Forms.MessageBoxButtons.YesNo")
loArray.AddItem( loComValue)*** Use InvokeMethod to pass the ComArray
? loBridge.InvokeMethod(loTest,"PassEnumArray",loArray)
? loArray.Count()RETURN
+++ Rick ---
The following works fine in c#
OCRWS_Language[] langs = { OCRWS_Language.ENGLISH, OCRWS_Language.GERMAN };
And this is the information from the .net Relector
I cannot for the life of me figure out how to set these values in VFP. Can anyone help me with this?
EDIT: I cannot post an image here. Any tips on how to do that?
Just re-download the registered version... I'm not sure if the update is in there or not, but there must be some difference if that code is not working for you.
Try that first.
If not can you go to:
http://west-wind.com/files/WebConnectionExperimental.zip
and grab wwdotnetBridge.dll and wwDotnetBridge.prg and update those in your code? I suspect this is what the problem is - an out of date version. I'm not sure if all the changes from this have made it into the Proxy Generator.
+++ Rick ---
The loComValue does show numeric value.
I just bought the Proxy Generator about 5 months ago. How do I get the latest version?
Make sure you have the latest version of the tool. This code might have been updated recently...
Also try this in the sample code:
loComValue.SetEnum("System.Windows.Forms.MessageBoxButtons.YesNo")
? loComValue.Value
This should show a numeric value of some sort.
+++ Rick ---
I get the same error with the test code you sent.
Don't know then... that should work unless the type is not really an enum. Also make sure you have the latest version.
Can you run the code sample code I sent you? (the final method call won't work but everything up to there should). Just put it into a PRG file and run. Does that work up to that final method?
+++ Rick ---
I copied it from the .NET reflector:
public enum OCRWS_Language
Name: OCRWebService.OCRWS_Language
Assembly: OCRWebServiceProxy, Version=0.0.0.0
This is the code I used:
LOCAL loArray as Westwind.WebConnection.ComArray
loArray = oBridge.CreateArray("OCRWebService.OCRWS_Language")
loComValue = oBridge.CreateComValue()
loComValue.SetEnum("OCRWebService.OCRWS_Language.ENGLISH")
loArray.AddItem(loComValue)
Make sure the type name is correct when you declare the array.
+++ Rick ---
Thanks, Rick, but when I get to the AddItem method I get the error "Object cannot be stored in an array of this type"
Hi Lyn,
Enums are a bit tricky in VFP because VFP has no concept of them natively and it's doubly complicated for Arrays because of the strict typing requirement.
There are several ways to do this but the cleanes is to use the ComValue class to assign the Enum value and then assign it to a ComArray.
The following example demonstrates:
do wwDotNetBridge
LOCAL loBridge as wwDotNetBridge
loBridge = CreateObject("wwDotNetBridge","V4")
loBridge.LoadAssembly("System.Windows.Forms")loTest = loBridge.CreateInstance("Westwind.WebConnection.TypePassingTests")
*** Create the array of the proper type
LOCAL loArray as Westwind.WebConnection.ComArray
loArray = loBridge.Createarray("System.Windows.Forms.MessageBoxButtons")*** Add each of the enum values as a ComValue
loComValue = loBridge.CreateComValue()
loComValue.SetEnum("System.Windows.Forms.MessageBoxButtons.OK")
loArray.AddItem( loComValue)loComValue = loBridge.CreateComValue()
loComValue.SetEnum("System.Windows.Forms.MessageBoxButtons.OKCancel")
loArray.AddItem( loComValue)loComValue = loBridge.CreateComValue()
loComValue.SetEnum("System.Windows.Forms.MessageBoxButtons.YesNo")
loArray.AddItem( loComValue)*** Use InvokeMethod to pass the ComArray
? loBridge.InvokeMethod(loTest,"PassEnumArray",loArray)
? loArray.Count()RETURN
+++ Rick ---
The following works fine in c#
OCRWS_Language[] langs = { OCRWS_Language.ENGLISH, OCRWS_Language.GERMAN };
And this is the information from the .net Relector
I cannot for the life of me figure out how to set these values in VFP. Can anyone help me with this?
EDIT: I cannot post an image here. Any tips on how to do that?
West Wind Technologies
Making waves on the Web
from Maui
oSettings = oBridge.CreateInstance("OCRWebService.OCRWSSettings")
oBridge.InvokeMethod(oSettings, "ocrLanguages", loArray)
gives the error "Method ""OCRWebService.OCRWSSettings.ocrLanguages" is not found.
This is the c# code used:
ocrSettings.ocrLanguages = langs; // where langs is the array created in the first code snippet I sent
Just re-download the registered version... I'm not sure if the update is in there or not, but there must be some difference if that code is not working for you.
Try that first.
If not can you go to:
http://west-wind.com/files/WebConnectionExperimental.zip
and grab wwdotnetBridge.dll and wwDotnetBridge.prg and update those in your code? I suspect this is what the problem is - an out of date version. I'm not sure if all the changes from this have made it into the Proxy Generator.
+++ Rick ---
The loComValue does show numeric value.
I just bought the Proxy Generator about 5 months ago. How do I get the latest version?
Make sure you have the latest version of the tool. This code might have been updated recently...
Also try this in the sample code:
loComValue.SetEnum("System.Windows.Forms.MessageBoxButtons.YesNo")
? loComValue.Value
This should show a numeric value of some sort.
+++ Rick ---
I get the same error with the test code you sent.
Don't know then... that should work unless the type is not really an enum. Also make sure you have the latest version.
Can you run the code sample code I sent you? (the final method call won't work but everything up to there should). Just put it into a PRG file and run. Does that work up to that final method?
+++ Rick ---
I copied it from the .NET reflector:
public enum OCRWS_Language
Name: OCRWebService.OCRWS_Language
Assembly: OCRWebServiceProxy, Version=0.0.0.0
This is the code I used:
LOCAL loArray as Westwind.WebConnection.ComArray
loArray = oBridge.CreateArray("OCRWebService.OCRWS_Language")
loComValue = oBridge.CreateComValue()
loComValue.SetEnum("OCRWebService.OCRWS_Language.ENGLISH")
loArray.AddItem(loComValue)
Make sure the type name is correct when you declare the array.
+++ Rick ---
Thanks, Rick, but when I get to the AddItem method I get the error "Object cannot be stored in an array of this type"
Hi Lyn,
Enums are a bit tricky in VFP because VFP has no concept of them natively and it's doubly complicated for Arrays because of the strict typing requirement.
There are several ways to do this but the cleanes is to use the ComValue class to assign the Enum value and then assign it to a ComArray.
The following example demonstrates:
do wwDotNetBridge
LOCAL loBridge as wwDotNetBridge
loBridge = CreateObject("wwDotNetBridge","V4")
loBridge.LoadAssembly("System.Windows.Forms")loTest = loBridge.CreateInstance("Westwind.WebConnection.TypePassingTests")
*** Create the array of the proper type
LOCAL loArray as Westwind.WebConnection.ComArray
loArray = loBridge.Createarray("System.Windows.Forms.MessageBoxButtons")*** Add each of the enum values as a ComValue
loComValue = loBridge.CreateComValue()
loComValue.SetEnum("System.Windows.Forms.MessageBoxButtons.OK")
loArray.AddItem( loComValue)loComValue = loBridge.CreateComValue()
loComValue.SetEnum("System.Windows.Forms.MessageBoxButtons.OKCancel")
loArray.AddItem( loComValue)loComValue = loBridge.CreateComValue()
loComValue.SetEnum("System.Windows.Forms.MessageBoxButtons.YesNo")
loArray.AddItem( loComValue)*** Use InvokeMethod to pass the ComArray
? loBridge.InvokeMethod(loTest,"PassEnumArray",loArray)
? loArray.Count()RETURN
+++ Rick ---
The following works fine in c#
OCRWS_Language[] langs = { OCRWS_Language.ENGLISH, OCRWS_Language.GERMAN };
And this is the information from the .net Relector
I cannot for the life of me figure out how to set these values in VFP. Can anyone help me with this?
EDIT: I cannot post an image here. Any tips on how to do that?
Thanks for all your help! I truly appreciate it (and I know what a pain tech support can be!)
Thanks. That worked for getting past "AddItem" but now I can't actually add the array to the instance:
oSettings = oBridge.CreateInstance("OCRWebService.OCRWSSettings")
oBridge.InvokeMethod(oSettings, "ocrLanguages", loArray)
gives the error "Method ""OCRWebService.OCRWSSettings.ocrLanguages" is not found.
This is the c# code used:
ocrSettings.ocrLanguages = langs; // where langs is the array created in the first code snippet I sent
Just re-download the registered version... I'm not sure if the update is in there or not, but there must be some difference if that code is not working for you.
Try that first.
If not can you go to:
http://west-wind.com/files/WebConnectionExperimental.zip
and grab wwdotnetBridge.dll and wwDotnetBridge.prg and update those in your code? I suspect this is what the problem is - an out of date version. I'm not sure if all the changes from this have made it into the Proxy Generator.
+++ Rick ---
The loComValue does show numeric value.
I just bought the Proxy Generator about 5 months ago. How do I get the latest version?
Make sure you have the latest version of the tool. This code might have been updated recently...
Also try this in the sample code:
loComValue.SetEnum("System.Windows.Forms.MessageBoxButtons.YesNo")
? loComValue.Value
This should show a numeric value of some sort.
+++ Rick ---
I get the same error with the test code you sent.
Don't know then... that should work unless the type is not really an enum. Also make sure you have the latest version.
Can you run the code sample code I sent you? (the final method call won't work but everything up to there should). Just put it into a PRG file and run. Does that work up to that final method?
+++ Rick ---
I copied it from the .NET reflector:
public enum OCRWS_Language
Name: OCRWebService.OCRWS_Language
Assembly: OCRWebServiceProxy, Version=0.0.0.0
This is the code I used:
LOCAL loArray as Westwind.WebConnection.ComArray
loArray = oBridge.CreateArray("OCRWebService.OCRWS_Language")
loComValue = oBridge.CreateComValue()
loComValue.SetEnum("OCRWebService.OCRWS_Language.ENGLISH")
loArray.AddItem(loComValue)
Make sure the type name is correct when you declare the array.
+++ Rick ---
Thanks, Rick, but when I get to the AddItem method I get the error "Object cannot be stored in an array of this type"
Hi Lyn,
Enums are a bit tricky in VFP because VFP has no concept of them natively and it's doubly complicated for Arrays because of the strict typing requirement.
There are several ways to do this but the cleanes is to use the ComValue class to assign the Enum value and then assign it to a ComArray.
The following example demonstrates:
do wwDotNetBridge
LOCAL loBridge as wwDotNetBridge
loBridge = CreateObject("wwDotNetBridge","V4")
loBridge.LoadAssembly("System.Windows.Forms")loTest = loBridge.CreateInstance("Westwind.WebConnection.TypePassingTests")
*** Create the array of the proper type
LOCAL loArray as Westwind.WebConnection.ComArray
loArray = loBridge.Createarray("System.Windows.Forms.MessageBoxButtons")*** Add each of the enum values as a ComValue
loComValue = loBridge.CreateComValue()
loComValue.SetEnum("System.Windows.Forms.MessageBoxButtons.OK")
loArray.AddItem( loComValue)loComValue = loBridge.CreateComValue()
loComValue.SetEnum("System.Windows.Forms.MessageBoxButtons.OKCancel")
loArray.AddItem( loComValue)loComValue = loBridge.CreateComValue()
loComValue.SetEnum("System.Windows.Forms.MessageBoxButtons.YesNo")
loArray.AddItem( loComValue)*** Use InvokeMethod to pass the ComArray
? loBridge.InvokeMethod(loTest,"PassEnumArray",loArray)
? loArray.Count()RETURN
+++ Rick ---
The following works fine in c#
OCRWS_Language[] langs = { OCRWS_Language.ENGLISH, OCRWS_Language.GERMAN };
And this is the information from the .net Relector
I cannot for the life of me figure out how to set these values in VFP. Can anyone help me with this?
EDIT: I cannot post an image here. Any tips on how to do that?
It's a property not a method. Use the SetProperty() method instead.
+++ Rick ---
I figured it out. I had to use the SetProperty method.
Thanks for all your help! I truly appreciate it (and I know what a pain tech support can be!)
Thanks. That worked for getting past "AddItem" but now I can't actually add the array to the instance:
oSettings = oBridge.CreateInstance("OCRWebService.OCRWSSettings")
oBridge.InvokeMethod(oSettings, "ocrLanguages", loArray)
gives the error "Method ""OCRWebService.OCRWSSettings.ocrLanguages" is not found.
This is the c# code used:
ocrSettings.ocrLanguages = langs; // where langs is the array created in the first code snippet I sent
Just re-download the registered version... I'm not sure if the update is in there or not, but there must be some difference if that code is not working for you.
Try that first.
If not can you go to:
http://west-wind.com/files/WebConnectionExperimental.zip
and grab wwdotnetBridge.dll and wwDotnetBridge.prg and update those in your code? I suspect this is what the problem is - an out of date version. I'm not sure if all the changes from this have made it into the Proxy Generator.
+++ Rick ---
The loComValue does show numeric value.
I just bought the Proxy Generator about 5 months ago. How do I get the latest version?
Make sure you have the latest version of the tool. This code might have been updated recently...
Also try this in the sample code:
loComValue.SetEnum("System.Windows.Forms.MessageBoxButtons.YesNo")
? loComValue.Value
This should show a numeric value of some sort.
+++ Rick ---
I get the same error with the test code you sent.
Don't know then... that should work unless the type is not really an enum. Also make sure you have the latest version.
Can you run the code sample code I sent you? (the final method call won't work but everything up to there should). Just put it into a PRG file and run. Does that work up to that final method?
+++ Rick ---
I copied it from the .NET reflector:
public enum OCRWS_Language
Name: OCRWebService.OCRWS_Language
Assembly: OCRWebServiceProxy, Version=0.0.0.0
This is the code I used:
LOCAL loArray as Westwind.WebConnection.ComArray
loArray = oBridge.CreateArray("OCRWebService.OCRWS_Language")
loComValue = oBridge.CreateComValue()
loComValue.SetEnum("OCRWebService.OCRWS_Language.ENGLISH")
loArray.AddItem(loComValue)
Make sure the type name is correct when you declare the array.
+++ Rick ---
Thanks, Rick, but when I get to the AddItem method I get the error "Object cannot be stored in an array of this type"
Hi Lyn,
Enums are a bit tricky in VFP because VFP has no concept of them natively and it's doubly complicated for Arrays because of the strict typing requirement.
There are several ways to do this but the cleanes is to use the ComValue class to assign the Enum value and then assign it to a ComArray.
The following example demonstrates:
do wwDotNetBridge
LOCAL loBridge as wwDotNetBridge
loBridge = CreateObject("wwDotNetBridge","V4")
loBridge.LoadAssembly("System.Windows.Forms")loTest = loBridge.CreateInstance("Westwind.WebConnection.TypePassingTests")
*** Create the array of the proper type
LOCAL loArray as Westwind.WebConnection.ComArray
loArray = loBridge.Createarray("System.Windows.Forms.MessageBoxButtons")*** Add each of the enum values as a ComValue
loComValue = loBridge.CreateComValue()
loComValue.SetEnum("System.Windows.Forms.MessageBoxButtons.OK")
loArray.AddItem( loComValue)loComValue = loBridge.CreateComValue()
loComValue.SetEnum("System.Windows.Forms.MessageBoxButtons.OKCancel")
loArray.AddItem( loComValue)loComValue = loBridge.CreateComValue()
loComValue.SetEnum("System.Windows.Forms.MessageBoxButtons.YesNo")
loArray.AddItem( loComValue)*** Use InvokeMethod to pass the ComArray
? loBridge.InvokeMethod(loTest,"PassEnumArray",loArray)
? loArray.Count()RETURN
+++ Rick ---
The following works fine in c#
OCRWS_Language[] langs = { OCRWS_Language.ENGLISH, OCRWS_Language.GERMAN };
And this is the information from the .net Relector
I cannot for the life of me figure out how to set these values in VFP. Can anyone help me with this?
EDIT: I cannot post an image here. Any tips on how to do that?
West Wind Technologies
Making waves on the Web
from Maui
I've updated the Proxy Generator to include the latest libraries today. There are a number of other small fixes in this batch but for the most part it's just a maintenance release.
http://west-wind.com/WsdlGenerator
If you're a registered user download the updated registered version as per your registration URL provided.
+++ Rick ---
The following works fine in c#
OCRWS_Language[] langs = { OCRWS_Language.ENGLISH, OCRWS_Language.GERMAN };
And this is the information from the .net Relector
I cannot for the life of me figure out how to set these values in VFP. Can anyone help me with this?
EDIT: I cannot post an image here. Any tips on how to do that?
West Wind Technologies
Making waves on the Web
from Maui