Click here to Skip to main content
15,881,380 members
Home / Discussions / C#
   

C#

 
GeneralRe: How to find IPv4 NOT IPv6 C# ... Pin
Richard MacCutchan29-Jan-14 22:52
mveRichard MacCutchan29-Jan-14 22:52 
QuestionDatagridview Comboboxes C# Pin
HobbyProggy29-Jan-14 20:54
professionalHobbyProggy29-Jan-14 20:54 
AnswerRe: Datagridview Comboboxes C# Pin
HobbyProggy29-Jan-14 22:14
professionalHobbyProggy29-Jan-14 22:14 
AnswerRe: Datagridview Comboboxes C# Pin
Rahul VB30-Jan-14 17:47
professionalRahul VB30-Jan-14 17:47 
QuestionXML load into a variable or file Pin
Rahul Vairagi29-Jan-14 18:47
Rahul Vairagi29-Jan-14 18:47 
AnswerRe: XML load into a variable or file Pin
Shameel29-Jan-14 20:31
professionalShameel29-Jan-14 20:31 
AnswerRe: XML load into a variable or file Pin
jschell30-Jan-14 8:31
jschell30-Jan-14 8:31 
GeneralHow to find IPv4 NOT IPv6 C# [Moved] Pin
Lester Wagner29-Jan-14 18:16
Lester Wagner29-Jan-14 18:16 
Hi guys

I am having this problem, I wrote a small app to display the computers hostname and IP address.

Hostname horks no problem, the issue I am sitting with is...

On some Windows 7 / 8 computers is displays the IPv6 Frown | :(

How do I force to only return IPv4 everytime?

This is my Code:

C#
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Net;

namespace IPChecker
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

private void Form1_Load(object sender, EventArgs e)
{
label1.Text = "Host Computer: " + Dns.GetHostName();
foreach (IPAddress address in Dns.GetHostAddresses(Dns.GetHostName()))
{
label2.Text = "IP Address: " + address;
}
}
}
}


modified 30-Jan-14 7:58am.

GeneralRe: How to find IPv4 NOT IPv6 C# PinPopular
_Maxxx_29-Jan-14 18:31
professional_Maxxx_29-Jan-14 18:31 
GeneralRe: How to find IPv4 NOT IPv6 C# Pin
Lester Wagner29-Jan-14 18:53
Lester Wagner29-Jan-14 18:53 
GeneralRe: How to find IPv4 NOT IPv6 C# Pin
walterhevedeich29-Jan-14 19:14
professionalwalterhevedeich29-Jan-14 19:14 
JokeRe: How to find IPv4 NOT IPv6 C# Pin
walterhevedeich29-Jan-14 19:16
professionalwalterhevedeich29-Jan-14 19:16 
GeneralRe: How to find IPv4 NOT IPv6 C# Pin
ZurdoDev30-Jan-14 1:50
professionalZurdoDev30-Jan-14 1:50 
GeneralRe: How to find IPv4 NOT IPv6 C# Pin
JimmyRopes29-Jan-14 19:20
professionalJimmyRopes29-Jan-14 19:20 
GeneralRe: How to find IPv4 NOT IPv6 C# Pin
Shameel29-Jan-14 19:33
professionalShameel29-Jan-14 19:33 
GeneralRe: How to find IPv4 NOT IPv6 C# Pin
Lester Wagner29-Jan-14 19:58
Lester Wagner29-Jan-14 19:58 
GeneralRe: How to find IPv4 NOT IPv6 C# Pin
JimmyRopes29-Jan-14 21:35
professionalJimmyRopes29-Jan-14 21:35 
GeneralRe: How to find IPv4 NOT IPv6 C# Pin
Lester Wagner29-Jan-14 21:55
Lester Wagner29-Jan-14 21:55 
JokeRe: How to find IPv4 NOT IPv6 C# Pin
Joan M29-Jan-14 19:21
professionalJoan M29-Jan-14 19:21 
GeneralRe: How to find IPv4 NOT IPv6 C# Pin
Jim Meadors29-Jan-14 19:29
Jim Meadors29-Jan-14 19:29 
JokeRe: How to find IPv4 NOT IPv6 C# Pin
Joan M29-Jan-14 19:31
professionalJoan M29-Jan-14 19:31 
GeneralRe: How to find IPv4 NOT IPv6 C# Pin
Jim Meadors29-Jan-14 19:37
Jim Meadors29-Jan-14 19:37 
GeneralRe: How to find IPv4 NOT IPv6 C# Pin
Worried Brown Eyes29-Jan-14 21:16
Worried Brown Eyes29-Jan-14 21:16 
GeneralRe: How to find IPv4 NOT IPv6 C# Pin
User 5924129-Jan-14 19:38
User 5924129-Jan-14 19:38 
GeneralRe: How to find IPv4 NOT IPv6 C# Pin
TheGreatAndPowerfulOz29-Jan-14 20:39
TheGreatAndPowerfulOz29-Jan-14 20:39 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.