hey guys, i have this piece of code:
Basically what it does is that it detects your wireless network and outputs it. Now problem is that when i view the output in console mode, i can see everything clearly. The ssid mainly.
However, if i output it to the label1.Text ... all i get is a giant dot in the label. Im guessing the encoding is wrong, but after trying every single encoding avaliable, im kinda lost.
Any ideas?
Code:
ManagementClass mc = new ManagementClass("root\\WMI","MSNdis_80211_ServiceSetIdentifier", null);
ManagementObjectCollection moc = mc.GetInstances();
foreach (ManagementObject mo in moc)
{
string wlanCard = (string)mo["InstanceName"];
bool active = (bool)mo["Active"];
byte[] ssid = (byte[])mo["Ndis80211SsId"];
string ssidString = Encoding.ASCII.GetString(ssid);
label1.Text = string.Format("{0}\r\n{1}\r\n{2}", wlanCard, active, ssidString);
Console.WriteLine("{0}\r\n{1}\r\n{2}", wlanCard, active, ssidString);
Console.WriteLine();
}
However, if i output it to the label1.Text ... all i get is a giant dot in the label. Im guessing the encoding is wrong, but after trying every single encoding avaliable, im kinda lost.
Any ideas?