I'm not a c# programmer but I'm trying to do straight conversion of the c# code to vb code for this page...
http://atlas.asp.net/atlastoolkit/CascadingDropDown/CascadingDropDown.aspx
...and I'm getting an error on the "return" line that says...
Value of type '1-dimensional array of AtlasControlToolkit.CascadingDropDownNameValue' cannot be converted to 'AtlasControlToolkit.CascadingDropDownNameValue'.
Here is the original c# code...
using System;
using System.Web;
using System.Collections;
using System.Collections.Specialized;
using System.Web.Services;
using System.Web.Services.Protocols;
using System.Xml;
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
public class CarsService : System.Web.Services.WebService
{
// Member variables
private readonly XmlDocument _document;
private readonly string[] _hierarchy;
public CarsService()
{
// Read XML data from disk
_document = new XmlDocument();
_document.Load(Server.MapPath("CarsService.xml"));
// Represent the hierarchy of data - "make" controls "model" (which implicitly controls "color")
_hierarchy = new string[] { "make", "model" };
}
[WebMethod]
public AtlasControlToolkit.CascadingDropDownNameValue[] GetDropDownContents(string knownCategoryValues, string category)
{
// Get a dictionary of known category/value pairs
StringDictionary knownCategoryValuesDictionary = AtlasControlToolkit.CascadingDropDown.ParseKnownCategoryValuesString(knownCategoryValues);
// Perform a simple query against the data document
return AtlasControlToolkit.CascadingDropDown.QuerySimpleCascadingDropDownDocument(_document, _hierarchy, knownCategoryValuesDictionary, category);
}
}
And here is my vb code...
Imports System.Web
Imports System.Web.Services
Imports System.Web.Services.Protocols
Imports System.Collections
Imports System.Collections.Specialized
Imports System.Xml
Imports Microsoft.AtlasControlExtender
Imports AtlasControlToolkit
<WebService(Namespace:="http://tempuri.org/")> _
<WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)> _
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Public Class CarsService
Inherits System.Web.Services.WebService
Dim document as New XmlDocument()
Dim hierarchy as String()
Public Sub CarsService()
'Read XML data from disk
document.Load(Server.MapPath("CarsService.xml"))
hierarchy = New String() {"make", "model"}
End Sub
<WebMethod()> _
Public Function GetDropDownContents(byVal knownCategoryValues as String, byVal category as String) as AtlasControlToolkit.CascadingDropDownNameValue
Dim knownCategoryValuesDictionary as New StringDictionary
knownCategoryValuesDictionary = AtlasControlToolkit.CascadingDropDown.ParseKnownCategoryValuesString(knownCategoryValues)
Return AtlasControlToolkit.CascadingDropDown.QuerySimpleCascadingDropDownDocument(document, hierarchy, knownCategoryValuesDictionary, category)
End Function Is there anybody that might be able to help with this? Thanks!