|
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 |
How do I force to only return IPv4 everytime?
This is my Code:
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.
|
|
|
|
|
|
I am not sure how to actually put it together to make this work? Could you advise please ?
|
|
|
|
|
Just refer to the documentation. For each IP address check the property that tells you if it is an IPv4 or IPv6 address.
Veni, vidi, abiit domum
|
|
|
|
|
Hi there,
i finally got a Problem
I have a DataGridView and in 2 cloumns there are comboboxes.
Now, what my question is:
In the first Combobox there are resources diplayed, in the second one roles.
If i choose one of the roles the resource box is refilled with resources that fit the selected role.
But the Problem is that after adding multiple rolerestrictions in the second comboboxes i only have the resource result of the last added row.
How do i get the comboboxes to work per row not as a coloumn ?
It should work like this:
----cb1----------cb2
TBD TL Res----Teamleader <- only teamleader resources avail
TBD SW Eng----Software Engineer <- only Software Engineers avail
TBD Proj M----Project Manager <- only Project Managers avail
Hope this Question is not 2 squishy
if(this.signature != "")
{
MessageBox.Show("This is my signature: " + Environment.NewLine + signature);
}
else
{
MessageBox.Show("404-Signature not found");
}
|
|
|
|
|
|
Congrats bro, well done.
5!
|
|
|
|
|
Hi,
1> I am writing a code which will call a web-service and populate xml data into a variable and then processing that data to a database table.
2> I am writing a code which will call a web-service and retrieve the XML data and write into a file(XML). And then it will process the data from that XML file to a database table.
My question is: Which is the best way: "1" or "2".
thinking all scenarios ..means
if volume of data will be more in future
performance
data reliability
flexibility,etc..
Kindly share your opinion !!
Rahul Vairagi
-----------------------------------
www.sqlserver2005forum.blogspot.com
|
|
|
|
|
Obviously, option 1 is your best bet. I assume by 'variable' you mean a data structure that can hold your xml in memory.
What is the purpose of storing it in a file? If you're concerned about losing data due to write speed and the load on the database, consider using an MQ solution. Besides being slow, writing to file requires lot of disk space and is prone to file locking issues and also requires periodic cleanup.
modified 30-Jan-14 2:55am.
|
|
|
|
|
Depends on various factors.
For starters what exactly do you mean by "volume". Do you have actual realistic numbers?
For example if you have 1 record a day now and 10 in three years it doesn't matter.
If you have 100,000 a day now and expect, realistically, 10 million at the end of the year then that is a different matter.
Also do you need to process the XML before putting into the database?
What happens if you go to the web-service right now and it isn't up? And it stays down until tomorrow? What happens if your database is down and stays down until tomorrow?
|
|
|
|
|
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
How do I force to only return IPv4 everytime?
This is my Code:
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.
|
|
|
|
|
Hi & welcome to Code Project
This is the lounge, where regulars get irate if people pose programming questions - so I'd grab this one and post it to another area - probably Quick Questions, from the menu at the top of the screen.
Fortunately I don't get irate at such trivialities.
MVVM # - I did it My Way
___________________________________________
Man, you're a god. - walterhevedeich 26/05/2011
.\\axxx
(That's an 'M')
|
|
|
|
|
Hi there
Thank you
How do I move this to quick questions?
|
|
|
|
|
Just create a question by clicking the widget below.
Ask a Question
Signature construction in progress. Sorry for the inconvenience.
Damn you have the perfect signature - CBadger
|
|
|
|
|
_Maxxx_ wrote: This is the lounge, where regulars get irate if people pose programming questions
Don't. You'll scare him.
Signature construction in progress. Sorry for the inconvenience.
Damn you have the perfect signature - CBadger
|
|
|
|
|
Quote: Fortunately I don't get irate at such trivialities. A simple search on CP may disagree.
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
As Maxxxxx said the proper place to ask this is in quick questions but since you are new to CodeProject I will answer your question here.
You are replacing the test in label2 with every iteration of the loop so you are only seeing the last entry.
Replace the label2 with a listbox and define an integer i = 0 outside of your loop.
listBox1.Items.Insert(i++, "IP Address: " + address);
This is one free pass. After this expect to be criticized for asking programming questions here.
|
|
|
|
|
JimmyRopes wrote: This is one free pass. After this expect to be criticized for asking programming questions here.
How irresponsible. It is only because of people like you that The Lounge, our dear Lounge is being flooded with programming questions, taking away valuable space that is reserved for crap jokes.
|
|
|
|
|
You guys are too kind :P
Thanks for the help! I'm using a listbox now it is working and showing all the IP's that's on my machine.
But how does it work, in which position is the IPv4 address?
Is there a way to just display the IPv4 in a basic label?
|
|
|
|
|
Now you are asking a second programming question in the lounge!
I want to direct you to the top of the page where it states:
Technical discussions are welcome, but if you need specific help please use the programming forums.
|
|
|
|
|
I have moved this, thanks guys
|
|
|
|
|
AAAAAARGH ARGH AAAAAAAARGHHH ARRRRRRRGH AAAAAAAAAAARGGGGGGHHH!
Just to clarify by example what others said...
modified 30-Jan-14 2:39am.
|
|
|
|
|
And then someone should explain to him about bacon...
<sig notetoself="think of a better signature">
<first>Jim</first> <last>Meadors</last>
</sig>
|
|
|
|
|
Wouldn't that be too much on the first day?
|
|
|
|
|
Yes but he will have to learn eventually
<sig notetoself="think of a better signature">
<first>Jim</first> <last>Meadors</last>
</sig>
|
|
|
|