|
Giorgi Dalakishvili wrote: Also, use BeginUpdate() EndUpdate() methods so that your listview isn't repainted any time an item is added.
Thanks for the response. I noticed that when I change the listview control to a listbox the problem does not occur anymore, so I will try the above mentioned response.
Many thanks
Kind regards,
The only programmers that are better those C# programmers are those who code in 1's and 0's |
Programm3r
My Blog: ^_^
|
|
|
|
|
|
Which overload of AddRange method are you using? Try using the one that takes ListViewItem[] as a parameter.
|
|
|
|
|
To be exact:
if (this.InvokeRequired)
{
this.Invoke(new EventHandler(delegate
{
lViewTransactionHistory.BeginUpdate();
ListViewItem item1 = new ListViewItem(DateTime.Now.ToLongTimeString(),0);
item1.SubItems.Add(i.ToString());
item1.SubItems.Add(TcpServer.connectData[i].Request);
item1.SubItems.Add("OK");
item1.SubItems.Add("CMD_PING");
lViewTransactionHistory.Items.AddRange(new ListViewItem[] { item1 });
lViewTransactionHistory.EndUpdate();
}));
}
else
{
...
}
So yes I am using the correct method overload.
The only programmers that are better those C# programmers are those who code in 1's and 0's |
Programm3r
My Blog: ^_^
|
|
|
|
|
You are doing practically the same thing you were doing in your original code. Instead of adding items one by one, store them in an array and add them in batch. If you are using backgroundworker you can use Result property to store listviewitem[] and access it when the worked is completed. In this case you can just add the items without the need of Invoke.
|
|
|
|
|
Ok, I understand what your saying, the only thing is that I wanted to display each of the events of the TCP server as it was received, real time. But if I put it into a batch / array and display it every x amount of time, this won't be the case. So this is what I wanted to achieve. But thank you very much for the info and help.
regards,
The only programmers that are better those C# programmers are those who code in 1's and 0's |
Programm3r
My Blog: ^_^
|
|
|
|
|
If you are using BackGroundWorker, you can report progress when event is received and pass necessary info or the item to it. In the ProgressChanged event handler you will not invoke to update listview.
|
|
|
|
|
i have placed a data grid inside a panel if the data grid have the record the panel will expand and if the data grid don't have a data then the height of the panel will be zero. how
i change a height property of a Panel according to the click of the
user how to set the height property and scroll property at run time
KnightGuy
|
|
|
|
|
From what I understand you are trying to do, you are trying to set the size of your panel to be equal to that of the contents inside of it?
You can loop for that
int i = 0;
int max = panel1.controls.items.count -1;
panel1.height = 0;
while i <= max
{
panel1.size += panel1.controls.items.i.height;
i++;
}
'edit
you can suspend your layout so you don't see it resize
|
|
|
|
|
Dear,
Can anyone give me a code that can print DataGridView in C#.NET 2005?
Socheat
|
|
|
|
|
I can't but Google can
|
|
|
|
|
Try rent-a-coder or google.
Jeez, we WORK for a living and you want us to give out da codz for free? Ask your Mumma about the meaning of the word 'polite'
Panic, Chaos, Destruction.
My work here is done.
|
|
|
|
|
Socheat.Net wrote: Can anyone give me a code
Once you say that, the answer automatically becomes "No", regardless of what the rest of the question or post says. You've been around here more than long enough to know that.
|
|
|
|
|
I posted a question a little while ago about how to link a treeview to a list view.
What i actuli was trying to say is "How Do you Binding a ListView to a TreeView"
|
|
|
|
|
Will you not do this. Post one question about a topic and then stick with it. Don't spam the boards.
|
|
|
|
|
Try keeping to one set of posts and put a useful topic. As far as I can remember, you have been asking this for the last 2 days and have been given loads of useful hints, so your best bet is either get a few books on programming in general and C# in particular, or try another career.
Bob
Ashfield Consultants Ltd
|
|
|
|
|
Hi
I am new to c# and im trying to link a treeview to a list view.
Thanks in Advance
|
|
|
|
|
And do what? One of the first things you need to learn as a developer is how to lay out your requirements. From your question, I have no idea what actions you expect.
|
|
|
|
|
Oh Sorry.
Im trying to make it so that when click on a node in the treeview it will display in the treeview.
|
|
|
|
|
One way to do this is to use the Tag to store the row in the TreeNode, and then find the same item in the ListView where you will also have stored the object in the Tag. This isn't a particularly elegant way, but will work for small solutions.
|
|
|
|
|
Hi,
what do you mean exactly by "link a treeview to a list view"? If you mean updating the listview when you click at the treeview, than you have to register for the SelectedIndexChanged (or something similar) event of the treeview and update you listview within the event handler.
Regards
Sebastian
|
|
|
|
|
Yes that what i meant
Thank You
|
|
|
|
|
You actually have to write code to do it (I know, that may be too close to being an actual programmer). There is no such thing as "linking" a view to another view. You can attach the same data source to both views.
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
Hi,
Is WPF is feasible enough to develop very complex games like motogp .
?
“You will never be a leader unless you first learn to follow and be led.”
–Tiorio
"Coming together is a beginning, staying together is progress, and working together is success." Henry Ford
|
|
|
|
|
Lol, no. Those are written in native C++ and use DirectX.
|
|
|
|