Click here to Skip to main content
15,886,017 members
Home / Discussions / C#
   

C#

 
GeneralRe: C# Guinea Pig Needed Pin
.dan.g.30-Jul-15 2:41
professional.dan.g.30-Jul-15 2:41 
GeneralRe: C# Guinea Pig Needed Pin
Manfred Rudolf Bihy30-Jul-15 2:46
professionalManfred Rudolf Bihy30-Jul-15 2:46 
GeneralRe: C# Guinea Pig Needed Pin
.dan.g.30-Jul-15 2:49
professional.dan.g.30-Jul-15 2:49 
GeneralRe: C# Guinea Pig Needed Pin
Maciej Los30-Jul-15 3:00
mveMaciej Los30-Jul-15 3:00 
GeneralRe: C# Guinea Pig Needed Pin
.dan.g.30-Jul-15 2:41
professional.dan.g.30-Jul-15 2:41 
QuestionDoes anyone have chart control Recommended for C# WinForm Pin
goldsoft28-Jul-15 22:50
goldsoft28-Jul-15 22:50 
AnswerRe: Does anyone have chart control Recommended for C# WinForm Pin
roks nicolas28-Jul-15 22:59
professionalroks nicolas28-Jul-15 22:59 
QuestionPing Multiple servers and output to labels Pin
AndrewXtreme28-Jul-15 14:53
AndrewXtreme28-Jul-15 14:53 
I have 3 servers that I wish to monitor through a Windows form and then display the RoundtripTime in 'ms' on a form in their corresponding labels.

Servers are Server1, Server2, Server3
Labels are Label1, Label2, Label3

Using the below code I am easily able to loop through these servers and output to console and even write to a single label only, but cannot figure out how to ping Server1, write to Label1; then Server2 to Label2 and so on...

Any advice would be much appreciated (I have // out the Console.Write lines, as these work, but are not what I want to achieve.

private void ping_Status(object sender, EventArgs e)
{
string[] pingsvrs = new string[3];
pingsvrs[0] = MyGlobals.Server1;
pingsvrs[1] = MyGlobals.Server2;
pingsvrs[2] = MyGlobals.Server3;

using (Ping ping = new Ping())
{
foreach (string pingsvr in pingsvrs)
{
//Console.WriteLine("Pinging: {0}", comp);
try
{
//Console.Write(" {0}...", comp);
PingReply reply = ping.Send(comp);
if (reply.Status == IPStatus.Success)
{
//Console.WriteLine("Success - IP Address:{0}..{1} ms", reply.Address, reply.RoundtripTime);
//string delay = string.Format("{0}", reply.RoundtripTime);
LabelX.Text = (delay + " ms");
}
else
{
//Console.WriteLine(reply.Status);
LabelX.Text = "Failed";
}
}
catch (Exception ex)
{
//Console.WriteLine("Error ({0})",
ex.InnerException.Message);
LabelX.Text = "Error";
}
}
}
}
AnswerRe: Ping Multiple servers and output to labels Pin
Dave Kreskowiak28-Jul-15 15:15
mveDave Kreskowiak28-Jul-15 15:15 
Questionthis is irelevant to code project but its part of c# Pin
jamesmc153528-Jul-15 3:51
jamesmc153528-Jul-15 3:51 
AnswerRe: this is irelevant to code project but its part of c# Pin
OriginalGriff28-Jul-15 4:10
mveOriginalGriff28-Jul-15 4:10 
GeneralRe: this is irelevant to code project but its part of c# Pin
jamesmc153528-Jul-15 4:13
jamesmc153528-Jul-15 4:13 
GeneralRe: this is irelevant to code project but its part of c# Pin
OriginalGriff28-Jul-15 4:34
mveOriginalGriff28-Jul-15 4:34 
Questiongroup by latest file Pin
scottichrosaviakosmos28-Jul-15 1:53
scottichrosaviakosmos28-Jul-15 1:53 
AnswerRe: group by latest file Pin
OriginalGriff28-Jul-15 2:22
mveOriginalGriff28-Jul-15 2:22 
AnswerRe: group by latest file Pin
Sebastiaan Lubbers29-Jul-15 0:18
professionalSebastiaan Lubbers29-Jul-15 0:18 
QuestionRecommendations for creating and printing a form on a A4 paper? Pin
DPaul199428-Jul-15 1:04
DPaul199428-Jul-15 1:04 
AnswerRe: Recommendations for creating and printing a form on a A4 paper? Pin
OriginalGriff28-Jul-15 1:13
mveOriginalGriff28-Jul-15 1:13 
GeneralRe: Recommendations for creating and printing a form on a A4 paper? Pin
DPaul199428-Jul-15 2:16
DPaul199428-Jul-15 2:16 
GeneralRe: Recommendations for creating and printing a form on a A4 paper? Pin
OriginalGriff28-Jul-15 2:19
mveOriginalGriff28-Jul-15 2:19 
GeneralRe: Recommendations for creating and printing a form on a A4 paper? Pin
DPaul199428-Jul-15 2:45
DPaul199428-Jul-15 2:45 
QuestionChart questions, 16 Lines / ChartAreas (Logic Analyzer) Pin
mattlas27-Jul-15 22:11
mattlas27-Jul-15 22:11 
AnswerRe: Chart questions, 16 Lines / ChartAreas (Logic Analyzer) Pin
mattlas28-Jul-15 21:19
mattlas28-Jul-15 21:19 
Questionmvc Pin
Member 1186668527-Jul-15 7:48
Member 1186668527-Jul-15 7:48 
AnswerRe: mvc Pin
OriginalGriff27-Jul-15 8:03
mveOriginalGriff27-Jul-15 8:03 

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.