Well, I've figured out how to do it in C#

(I use the code that I've found in the site)
HOWEVER, I know only how to use it as a console application. I want to use it inside a form. Can you tell me how I can use this code inside a form so it will show the text in a label ?
Here is the code as a console application:
CODE
using System;
using System.Net;
using System.Runtime.InteropServices;
struct MIB_IPADDRROW
{
public int dwAddr;
public int dwIndex;
public int dwMask;
public int dwBCastAddr;
public int dwReasmSize;
public short unused1;
public short unused2;
}
class C
{
[DllImport("iphlpapi.dll")]
static extern int GetIpAddrTable(
IntPtr pIpAddrTable,
ref int pdwSize,
bool bOrder);
static string IPToString(int ipaddr)
{
return String.Format( "{0}.{1}.{2}.{3}",
(ipaddr >> 24) & 0xFF, (ipaddr >> 16) & 0xFF,
(ipaddr >> 8) & 0xFF, ipaddr & 0xFF);
}
static void Main()
{
IntPtr pBuf = IntPtr.Zero;
int nBufSize = 0;
GetIpAddrTable( IntPtr.Zero, ref nBufSize, false );
try {
pBuf = Marshal.AllocHGlobal( nBufSize );
int r = GetIpAddrTable( pBuf, ref nBufSize, false );
if ( r != 0 )
throw new System.ComponentModel.Win32Exception( r );
#if USE_UNSAFE_CODE
unsafe {
int nNumRows = *((int*)(void*)pBuf);
MIB_IPADDRROW* pRow =
(MIB_IPADDRROW*)(void*)(IntPtr)((int)pBuf + sizeof(int));
while ( nNumRows-- > 0 ) {
Console.WriteLine( IPToString( IPAddress.NetworkToHostOrder(
pRow->dwAddr ) ) );
pRow++;
}
}
}
catch (Exception ex) {
Console.WriteLine( ex.Message );
}
finally {
if ( pBuf != IntPtr.Zero )
Marshal.FreeHGlobal( pBuf );
}
}
}
Please tell me how to use it in a form.