Click here to Skip to main content
15,913,854 members
Home / Discussions / C#
   

C#

 
AnswerRe: c# extension methods syntax question Pin
BillWoodruff31-Jan-14 0:57
professionalBillWoodruff31-Jan-14 0:57 
GeneralRe: c# extension methods syntax question Pin
Richard Deeming31-Jan-14 2:05
mveRichard Deeming31-Jan-14 2:05 
GeneralRe: c# extension methods syntax question Pin
BillWoodruff31-Jan-14 5:48
professionalBillWoodruff31-Jan-14 5:48 
AnswerRe: c# extension methods syntax question Pin
Ennis Ray Lynch, Jr.31-Jan-14 9:49
Ennis Ray Lynch, Jr.31-Jan-14 9:49 
QuestionConsole Application c# & use shape & color Pin
vajihe.mirzaei30-Jan-14 5:38
vajihe.mirzaei30-Jan-14 5:38 
AnswerRe: Console Application c# & use shape & color Pin
OriginalGriff30-Jan-14 5:57
mveOriginalGriff30-Jan-14 5:57 
AnswerRe: Console Application c# & use shape & color Pin
Dave Kreskowiak30-Jan-14 6:18
mveDave Kreskowiak30-Jan-14 6:18 
AnswerRe: Console Application c# & use shape & color Pin
Rahul VB30-Jan-14 17:45
professionalRahul VB30-Jan-14 17:45 
AnswerRe: Console Application c# & use shape & color Pin
Pete O'Hanlon30-Jan-14 18:55
mvePete O'Hanlon30-Jan-14 18:55 
GeneralC# Pin
karthick.RR30-Jan-14 2:26
karthick.RR30-Jan-14 2:26 
GeneralRe: C# Pin
Dave Kreskowiak30-Jan-14 3:30
mveDave Kreskowiak30-Jan-14 3:30 
GeneralRe: C# Pin
Rahul VB30-Jan-14 22:37
professionalRahul VB30-Jan-14 22:37 
GeneralRe: C# Pin
Wayne Gaylard30-Jan-14 22:58
professionalWayne Gaylard30-Jan-14 22:58 
GeneralRe: C# Pin
Rahul VB30-Jan-14 23:44
professionalRahul VB30-Jan-14 23:44 
GeneralRe: C# Pin
agent_kruger31-Jan-14 23:15
professionalagent_kruger31-Jan-14 23:15 
QuestionC# code to check video quality Pin
AshwiniSH29-Jan-14 23:35
professionalAshwiniSH29-Jan-14 23:35 
AnswerRe: C# code to check video quality Pin
Richard MacCutchan30-Jan-14 0:47
mveRichard MacCutchan30-Jan-14 0:47 
AnswerRe: C# code to check video quality Pin
Dave Kreskowiak30-Jan-14 3:29
mveDave Kreskowiak30-Jan-14 3:29 
GeneralRe: C# code to check video quality Pin
Rahul VB31-Jan-14 5:57
professionalRahul VB31-Jan-14 5:57 
AnswerRe: C# code to check video quality Pin
Rahul VB31-Jan-14 6:03
professionalRahul VB31-Jan-14 6:03 
GeneralRe: C# code to check video quality Pin
Dave Kreskowiak31-Jan-14 9:41
mveDave Kreskowiak31-Jan-14 9:41 
GeneralRe: C# code to check video quality Pin
Rahul VB31-Jan-14 17:46
professionalRahul VB31-Jan-14 17:46 
GeneralRe: C# code to check video quality Pin
AshwiniSH3-Feb-14 23:07
professionalAshwiniSH3-Feb-14 23:07 
QuestionHow to find IPv4 NOT IPv6 C# ... Pin
Lester Wagner29-Jan-14 21:00
Lester Wagner29-Jan-14 21:00 
Hi guys I'm re-posting here now..
I posted earlier but in the wrong section.

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 | 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;
}
}
}
}


I have got some help:
"
Replace the label2 with a listbox and define an integer i = 0 outside of your loop.

listBox1.Items.Insert(i++, "IP Address: " + address);
"

This does work... Its shows all the IP's in a listbox BUT
I only want the IPv4 to display in a label. Simple and clean?

How would I go about doing this?
any help would be much appreciated.
AnswerRe: How to find IPv4 NOT IPv6 C# ... Pin
Richard MacCutchan29-Jan-14 22:10
mveRichard MacCutchan29-Jan-14 22:10 

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.