I'm working on an InfoPath form that is going to have a repeating table. In this form i'm using C# and WMI to retrieve hardware information for an inventory database. I've managed to figure out how to populate each row with the Network Interface and MAC Address, but i'm having difficulty when trying to get the IP Address, and I suspect i'll have the same problem trying to get the Subnet Mask, so if i can solve one i'll be able to solve the other.
The code i'm using is listed below (i stripped out the other code in there for the hardware not related to the Network Info), but when i use this code, in the IP Address field, it shows "System.String[]" instead of displaying the actual IP Address. Can some one please help me? I got my code samples from the WMI Code Creator and manipulated it to fit in with my existing code. It's pretty ugly right now, but so long as it works i dont care.
using
namespace
{
ManagementObjectSearcher
EventManager.FormEvents.Loading +=
}
foreach
xnMyForm.SelectSingleNode(
.SetValue(nicName);
.SetValue(nicMac);
.SetValue(nicIp);
counter++;
AddItem(nicName, nicMac, nicIp);
DeleteFirstEmptyItemNIC();
NamespaceManager.LookupNamespace(
node.InnerText = nicName;
field = doc.CreateElement(
node = group.AppendChild(field);
node.InnerText = nicMac;
node.InnerText = nicIp;
doc.AppendChild(group);
MainDataSource.CreateNavigator().SelectSingleNode(
NamespaceManager).AppendChild(doc.DocumentElement.CreateNavigator());
NamespaceManager);
itemNav.DeleteSelf();