応答可能なIP RoundtripTimeのリストをコンパイルするために、datagridviewのすべてのIPに対してpingを実行するアプリケーションがあります。ステップを完了したら、RoundtripTimeをdatagridviewに戻します。Ping.SendAsyncをdatagridviewで使用するには?
...
foreach (DataGridViewRow row in this.gvServersList.Rows)
{
this.current_row = row;
string ip = row.Cells["ipaddr_hide"].Value.ToString();
ping = new Ping();
ping.PingCompleted += new PingCompletedEventHandler(ping_PingCompleted);
ping.SendAsync(ip, 1000);
System.Threading.Thread.Sleep(5);
}
...
private static void ping_PingCompleted(object sender, PingCompletedEventArgs e)
{
var reply = e.Reply;
DataGridViewRow row = this.current_row; //notice here
DataGridViewCell speed_cell = row.Cells["speed"];
speed_cell.Value = reply.RoundtripTime;
}
私は現在の行を取得するためにDataGridViewRow row = this.current_row;
を使用しますが、私はエラーキーワードを取得したい「これは」バックのDataGridViewに値をプッシュする方法、静的function.soでは使用できませんか?
ありがとうございます。
ありがとう、それは私のための簡単な方法です! – jean