K
Karel Vandenhove
Hi,
I get an error "cannot apply indexing with [] to an expression of type
object" when I try to compile the code below.
SSLScannerManager is a COM component. (Used to access fingerprint
scanners and developed by neurotechnologija)
How does one get an array from a com component?
private void loadScanners()
{
SSLScannerMan scanMan = new SSLScannerMan();
scanMan.Initialize();
try
{
Int32 lenght = scanMan.DeviceCount;
object ids = new String[lenght];
scanMan.EnumDeviceIDs(ref ids);
scanners.Items.Clear();
for (Int32 i = 0; i < ((Array)ids).Length; i++)
{
String strTemp = (string) ((object)ids); // ERROR HERE
scanners.Items.Add(strTemp);
}
if (Scanner != null)
{
selected.Text = Scanner.DeviceID;
}
else
{
selected.Text = "N/A";
}
}
finally
{
scanMan.Finalize();
releaseComObject(scanMan);
}
}
I get an error "cannot apply indexing with [] to an expression of type
object" when I try to compile the code below.
SSLScannerManager is a COM component. (Used to access fingerprint
scanners and developed by neurotechnologija)
How does one get an array from a com component?
private void loadScanners()
{
SSLScannerMan scanMan = new SSLScannerMan();
scanMan.Initialize();
try
{
Int32 lenght = scanMan.DeviceCount;
object ids = new String[lenght];
scanMan.EnumDeviceIDs(ref ids);
scanners.Items.Clear();
for (Int32 i = 0; i < ((Array)ids).Length; i++)
{
String strTemp = (string) ((object)ids); // ERROR HERE
scanners.Items.Add(strTemp);
}
if (Scanner != null)
{
selected.Text = Scanner.DeviceID;
}
else
{
selected.Text = "N/A";
}
}
finally
{
scanMan.Finalize();
releaseComObject(scanMan);
}
}