Hi there, i'm trying to update/paint a listbox in real time, but i'm having some problems. I got a button to start the process of populating the listbox *button_traceroute_Click*.
My problem is that the listbox is only painted/updated when the whole process (button click) has ended, i wanted the the items to be inserted(viewed) one by one. I already tried using ListBox.Update() but nothing happened. (this is a traceroute)
private void button_traceroute_Click(object sender, EventArgs e)
{
String target;
int i = 0;
target = textBox_target.Text;
Mydata data = new Mydata();
TraceRoute traceroute = new TraceRoute();
while (i < 50 && !data.getReached() && !data.getError()) // i = hop count
{
data = traceroute.startTrace(target, data, i);
listBox_trace.Items.Add(data.getOutput());
i++;
}
}
data.getOutput() returns (string) something like: "Hop X: 165.468.354.4 -> 50 ms" or "Hop X: Timeout"
Mydata{
bool Finish flag;
bool Error flag;
int badcounter;
String output;
}
For now im populating the listbox with Strings, but the objective is to use a object.