I'm using this code now, but it always pops up the cmd to retrieve SSID and signal strength, so I think there must be a another way to do this.
If there is a way please let me know.
private void showConnectedID()
{
System.Diagnostics.Process p = new System.Diagnostics.Process();
p.StartInfo.FileName = "netsh.exe";
p.StartInfo.Arguments = "wlan show interfaces";
p.StartInfo.UseShellExecute = false;
p.StartInfo.RedirectStandardOutput = true;
p.Start();
try
{
string s = p.StandardOutput.ReadToEnd();
string s1 = s.Substring(s.IndexOf("SSID"));
s1 = s1.Substring(s1.IndexOf(":"));
s1 = s1.Substring(2, s1.IndexOf("\n")).Trim();
string s2 = s.Substring(s.IndexOf("Signal"));
s2 = s2.Substring(s2.IndexOf(":"));
s2 = s2.Substring(2, s2.IndexOf("\n")).Trim();
label1.Text = s1;
label4.Text = s2;
p.WaitForExit();
}
catch
{
label1.Text = "Notconnected";
label4.Text = "Notconnected";
}
}
my program picture
this is what happen when i turn it on