|
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>
|
|
|
|
|
Then leave it a while before elephant & sunshine.
modified 30-Jan-14 3:49am.
|
|
|
|
|
Welcome.
If you are a little confused at this point The Lounge is doing it's job.
Peter Wasser
Art is making something out of nothing and selling it.
Frank Zappa
|
|
|
|
|
Look here[^]
If your actions inspire others to dream more, learn more, do more and become more, you are a leader.-John Q. Adams You must accept one of two basic premises: Either we are alone in the universe, or we are not alone in the universe. And either way, the implications are staggering.-Wernher von Braun Only two things are infinite, the universe and human stupidity, and I'm not sure about the former.-Albert Einstein
|
|
|
|
|
Well, let me answer that for you:
First, this is rude, whatever you may think.
Second, before sending people out to google, propose to ask in Q&A or in a forum.
~RaGE();
I think words like 'destiny' are a way of trying to find order where none exists. - Christian Graus
Do not feed the troll ! - Common proverb
|
|
|
|
|
Really? Obviously not everyone thinks so, including me. And it's been SOP of the lounge for many years.
If your actions inspire others to dream more, learn more, do more and become more, you are a leader.-John Q. Adams You must accept one of two basic premises: Either we are alone in the universe, or we are not alone in the universe. And either way, the implications are staggering.-Wernher von Braun Only two things are infinite, the universe and human stupidity, and I'm not sure about the former.-Albert Einstein
|
|
|
|
|
You can't stoip it from returning IPv6 addresses, but you can filter the results you display.
GetHostAddresses() returns an array of IPAddress objects. Before you output the address, check its AddressFamily property for the enum value AddressFamily.InterNetwork . That's what will tell you what type of address it is. InterNetwork is IPv4.
|
|
|
|
|
You know how in the design mode of C # 2005, I want to change skins Ribbon (Black, Blue, Caramel, ...) by Developer Express tool. NET v8.3, do I have to go to?
|
|
|
|
|
If it is a third-party tool, the best place to get an answer is to get in touch with their support or browse through their forums.
|
|
|
|
|
I have a dataset and I want to bind my richtextbox to a field so that it autopopulates and when user leaves the textbox it validates for changes and updates the database field. How do I do this in WPF?
In winforms it is simple as rtb.Databindings.Add("Text", datasource, datafield)
but this is not in WPF
|
|
|
|
|
Googling brought me to this[^] forum. I wonder what prevented you from Googling as a first option.
|
|
|
|
|
Very nice Sir, how to up vote?
Well not actually but virtually i can
1 more upvote
|
|
|
|
|
I want to do something like the look and feel of what you get in Word 2013 when you click File / Open and select Recent.
This seems to be a list box of user controls. You can scroll up and down like a list box. But the items are not simple strings. Each item has two lines of text each a different font and there is a pushpin control on each item. I have no idea what to search for so probably the answer is out somewhere and I have been searching for the wrong keywords.
Thanks In Advance
Chris
|
|
|
|
|
|
Yes the Owner Draw should work for the two lines of text in different fonts on each item!
What about the Push Pin for each item?
It seems the push pin would have to be a button, or some sort of control. I have not been able find a way to put a button or other control on each item of a list box?
|
|
|
|
|
I have been experimenting with making a roll your own list box.
I use one panel, with auto scroll = true, as the ‘frame panel’ of the list box. Then I add an array of smaller horizontal ‘item panels’ to the frame panel. Each item panel is almost the width of the frame panel and placed below the previous panel down off the normally viewable area of the frame panel. The frame panel then shows the vertical scroll bar and the look is a lot like a list box.
Next for each item panel I will have to add labels for the text and a button for the push pin.
Has anyone tried anything like this before?
Any reason why it wouldn’t work?
Please! Tell me now, is there a better way?
|
|
|
|
|
I've created a program to send data to a serial port(rs 232,sr 485) every 3 millisecond . and receiving data on the other port.
sending works fine but receiving is not logical,see results at the end of this post.
codes:
int _counter = 0;
public delegate void TimerEventHandler(UInt32 id, UInt32 msg, ref UInt32 userCtx, UInt32 rsv1, UInt32 rsv2);
[DllImport("winmm.dll", SetLastError = true, EntryPoint = "timeSetEvent")]
static extern UInt32 timeSetEvent(UInt32 msDelay, UInt32 msResolution, TimerEventHandler handler, ref UInt32 userCtx, UInt32 eventType);
[DllImport("winmm.dll", SetLastError = true)]
static extern void timeKillEvent(UInt32 uTimerID);
TimerEventHandler tim;
public void Link(UInt32 id, UInt32 msg, ref UInt32 userCtx, UInt32 rsv1, UInt32 rsv2)
{
_counter++;
if ((_counter % interval) == 0)
{
timer_Elapsed3();
}
if (_counter > 1000.0*EndTime)
{
Stop();
}
}
#endregion
public void StartSendingLocations()
{
EndIndex = setEndIndex();
if (port==null)
{
port = new SerialPort(portName, rate);
reader.port = new SerialPort("COM4", rate);
reader.port.Open();
writer.port = port;
if (!port.IsOpen)
{
port.Open();
}
reader.mythread.Start();
}
tim = new TimerEventHandler(this.Link);
uint rsv = 0;
timerId = timeSetEvent(1, 1, tim, ref rsv, 1);
}
and timerElapsed3:
void timer_Elapsed3()
{
Index++;
ConstructSignal();
CreateCommand();
writer.SendCommand(port, command);
if (IsChartEnabled)
{
SignalWriter_DataSent(writer.WSignal);
}
if (SentFileLogger==null)
{
return;
}
SentFileLogger.Write(true, writer.WSignal.PitchLocation, writer.WSignal.PitchAngularVelocity,
writer.WSignal.RollLocation, writer.WSignal.RollAngularVelocity,
writer.WSignal.YawLocation, writer.WSignal.YawAngularVelocity, DateTime.Now.ToString("h:m:s:fff"));
}
and when dataReceived is invoked:
public void DataReceived2(ReadSignal signal)
{
try
{
RecFileLogger.Write(true, signal.PitchLocation, signal.RollLocation, signal.YawLocation, DateTime.Now.ToString("h:m:s:fff"));
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
}
}
result:
sending :
0.000 0.000 0.000 0.000 0.000 0.000 5:41:0:397
0.030 15.000 0.030 15.000 0.030 15.000 5:41:0:400
0.075 15.000 0.075 15.000 0.075 15.000 5:41:0:403
0.120 15.000 0.120 15.000 0.120 15.000 5:41:0:406
0.165 15.000 0.165 15.000 0.165 15.000 5:41:0:409
0.210 15.000 0.210 15.000 0.210 15.000 5:41:0:412
0.255 15.000 0.255 15.000 0.255 15.000 5:41:0:415
0.300 15.000 0.300 15.000 0.300 15.000 5:41:0:419
0.345 15.000 0.345 15.000 0.345 15.000 5:41:0:421
0.390 15.000 0.390 15.000 0.390 15.000 5:41:0:424
0.435 15.000 0.435 15.000 0.435 15.000 5:41:0:427
0.480 15.000 0.480 15.000 0.480 15.000 5:41:0:430
0.525 15.000 0.525 15.000 0.525 15.000 5:41:0:433
0.570 15.000 0.570 15.000 0.570 15.000 5:41:0:436
0.615 15.000 0.615 15.000 0.615 15.000 5:41:0:439
0.660 15.000 0.660 15.000 0.660 15.000 5:41:0:442
0.705 15.000 0.705 15.000 0.705 15.000 5:41:0:446
0.750 15.000 0.750 15.000 0.750 15.000 5:41:0:448
0.795 15.000 0.795 15.000 0.795 15.000 5:41:0:451
0.840 15.000 0.840 15.000 0.840 15.000 5:41:0:454
0.885 15.000 0.885 15.000 0.885 15.000 5:41:0:457
0.930 15.000 0.930 15.000 0.930 15.000 5:41:0:460
0.975 15.000 0.975 15.000 0.975 15.000 5:41:0:463
1.020 15.000 1.020 15.000 1.020 15.000 5:41:0:466
1.065 15.000 1.065 15.000 1.065 15.000 5:41:0:469
1.110 15.000 1.110 15.000 1.110 15.000 5:41:0:472
1.155 15.000 1.155 15.000 1.155 15.000 5:41:0:475
...
receiving:
0.000 0.000 0.000 5:41:0:469
0.029 0.029 0.029 5:41:0:469
0.074 0.074 0.074 5:41:0:470
0.119 0.119 0.119 5:41:0:470
0.165 0.165 0.165 5:41:0:471
0.209 0.209 0.209 5:41:0:472
0.254 0.254 0.254 5:41:0:472
0.299 0.299 0.299 5:41:0:473
0.345 0.345 0.345 5:41:0:554
0.389 0.389 0.389 5:41:0:555
0.434 0.434 0.434 5:41:0:556
0.479 0.479 0.479 5:41:0:557
0.525 0.525 0.525 5:41:0:558
0.570 0.570 0.570 5:41:0:559
0.614 0.614 0.614 5:41:0:559
0.659 0.659 0.659 5:41:0:560
0.704 0.704 0.704 5:41:0:561
0.750 0.750 0.750 5:41:0:562
0.794 0.794 0.794 5:41:0:563
0.839 0.839 0.839 5:41:0:564
0.884 0.884 0.884 5:41:0:564
0.930 0.930 0.930 5:41:0:565
0.974 0.974 0.974 5:41:0:565
1.019 1.019 1.019 5:41:0:566
1.064 1.064 1.064 5:41:0:567
1.110 1.110 1.110 5:41:0:568
1.155 1.155 1.155 5:41:0:569
1.199 1.199 1.199 5:41:0:569
...
you can see that I'm sending every 3 millisecond but receiving about 1 ms.why?
|
|
|
|