prashanth_gurijala
asked on
Integrating vb.net and c#
hi,
i have this methods in vb.net and i want to access them from c#
i am posting both of them...
can any one help me out
[[[[vb.net]]]]------------ ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- -
Imports System.Management
Public Function GetSignalStrength() As String
On Error GoTo oops
Dim query As ManagementObjectSearcher
Dim Qc As ManagementObjectCollection
Dim Oq As ObjectQuery
Dim Ms As ManagementScope
Dim Co As ConnectionOptions
Dim Mo As ManagementObject
Dim outp As String
Dim ssid As String
Co = New ConnectionOptions
Ms = New ManagementScope("root\wmi" )
Oq = New ObjectQuery("SELECT * FROM MSNdis_80211_ReceivedSigna lStrength Where active=true")
query = New ManagementObjectSearcher(M s, Oq)
Qc = query.Get
outp = ""
For Each Mo In query.Get
outp = outp & Mo("Ndis80211ReceivedSigna lStrength" ) & " "
Next
Return Trim(outp)
Exit Function
oops:
Return Err.Description
End Function
[[[[c# code]]]]------------------ ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ------
using System;
using System.Net;
using System.Net.Sockets;
namespace UdpEchoServer
{
class App
{
private const int ServerPortNumber = 9696;
[STAThread]
static void Main(string[] args)
{
try {
Socket udpSocket = new Socket(AddressFamily.Inter Network, SocketType.Dgram, ProtocolType.Udp);
EndPoint localEP = new IPEndPoint(IPAddress.Any, ServerPortNumber);
EndPoint remoteEP = new IPEndPoint(IPAddress.None, ServerPortNumber);
udpSocket.Bind(localEP);
byte [] receiveBuffer = new byte [512];
try
{
while (true)
{
int receivedSize = udpSocket.ReceiveFrom(rece iveBuffer, ref remoteEP);
***********//// i want to access the wireless signal strength method here
udpSocket.SendTo(receiveBu ffer, receivedSize, SocketFlags.None, remoteEP);
}
}
finally
{
udpSocket.Close();
}
}
catch (SocketException se)
{
Console.WriteLine(se.ToStr ing());
}
}
}
}
i have this methods in vb.net and i want to access them from c#
i am posting both of them...
can any one help me out
[[[[vb.net]]]]------------
Imports System.Management
Public Function GetSignalStrength() As String
On Error GoTo oops
Dim query As ManagementObjectSearcher
Dim Qc As ManagementObjectCollection
Dim Oq As ObjectQuery
Dim Ms As ManagementScope
Dim Co As ConnectionOptions
Dim Mo As ManagementObject
Dim outp As String
Dim ssid As String
Co = New ConnectionOptions
Ms = New ManagementScope("root\wmi"
Oq = New ObjectQuery("SELECT * FROM MSNdis_80211_ReceivedSigna
query = New ManagementObjectSearcher(M
Qc = query.Get
outp = ""
For Each Mo In query.Get
outp = outp & Mo("Ndis80211ReceivedSigna
Next
Return Trim(outp)
Exit Function
oops:
Return Err.Description
End Function
[[[[c# code]]]]------------------
using System;
using System.Net;
using System.Net.Sockets;
namespace UdpEchoServer
{
class App
{
private const int ServerPortNumber = 9696;
[STAThread]
static void Main(string[] args)
{
try {
Socket udpSocket = new Socket(AddressFamily.Inter
EndPoint localEP = new IPEndPoint(IPAddress.Any, ServerPortNumber);
EndPoint remoteEP = new IPEndPoint(IPAddress.None,
udpSocket.Bind(localEP);
byte [] receiveBuffer = new byte [512];
try
{
while (true)
{
int receivedSize = udpSocket.ReceiveFrom(rece
***********//// i want to access the wireless signal strength method here
udpSocket.SendTo(receiveBu
}
}
finally
{
udpSocket.Close();
}
}
catch (SocketException se)
{
Console.WriteLine(se.ToStr
}
}
}
}
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.