The following example VB Subroutine displays the properties of a IWorkspace object to a mesasge box
[Visual Basic 6.0]
Public Sub ListWorkspaceProp(pWorkspace As IWorkspace)
Dim Msg As String
Dim Title As String
Dim Response As Long
Dim i As Long
Dim sPropNames As Variant
Dim vPropValues As Variant
pWorkspace.ConnectionProperties.GetAllProperties sPropNames, vPropValues
Msg = ""
For i = LBound(sPropNames) To (UBound(sPropNames) - 1)
If (UCase(sPropNames(i)) = "PASSWORD") Then
Msg = Msg + LCase(sPropNames(i)) + ": " + Chr(13)
Else
Msg = Msg + LCase(sPropNames(i)) + ": " + vPropValues(i) + Chr(13)
End If
Next i
Title = "Workspace Properties"
Response = MsgBox(Msg, , Title)
End Sub
[C#]//IWorkspace ConnectionProperties Example
public void IWorkspace_ConnectionProperties_Example(IWorkspace workspace)
{
//The following function displays the properties of an IWorkspace
ESRI.ArcGIS.esriSystem.IPropertySet propertySet = workspace.ConnectionProperties;
object propertyNames;
object propertyValues;
propertySet.GetAllProperties(out propertyNames, out propertyValues);System.Array propNameArray = (System.Array)propertyNames;
System.Array propValuesArray = (System.Array)propertyValues;for (int i = 0; i < propNameArray.Length; i++)
{
Console.WriteLine("{0} = {1}", propNameArray.GetValue(i), propValuesArray.GetValue(i));
}
}
[Visual Basic .NET, C++]
No example is available for Visual Basic .NET or C++. To view a Visual Basic 6.0 or C# example, click the Language Filter button
in the upper-left corner of the page.