473,507 Members | 6,459 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

C#, multi-threading DataGridView scrollbar issue

15 New Member
I'm trying to add multi-thread capabilities to a program I am writing so the users aren't locked into loading a potentially large log file without being able to use the program for anything else. Everything is running smoothly, except that when the new thread finishes, the scrollbar for my DataGridView is horrendously broken. It appears as fragments of other parts of the interface, or not at all, and cannot be clicked on to scroll.

Here's a snippet of the code I'm using to open the new thread up:

Thread workThread = new Thread(LoadLog);
workThread.Start(openFileDialog1.FileName);

The code for LoadLog is extremely large, but what it is doing is parsing log lines into a more readable format, and using DataGridView.Rows.Add(blah, blah, blah) to update the DGV.

I've tried calling Refresh and turning ScrollBars on/off from within the thread, as well as making a delegate for the DGV's Refresh function and calling it at the end. The latter completely locked up my program whenever the number of lines called for the DGV to have a scroll bar.

Does anyone have any idea what the problem is and what I can do to fix it?
Mar 19 '08 #1
2 4472
balabaster
797 Recognized Expert Contributor
The biggest issue I've had with threading data into the UI is refreshing the form. I would suggest using a delegate to populate each row of your gridview rather than to refresh the gridview. Without seeing any of your code, I can't guarantee it though, just a hunch.
Mar 19 '08 #2
RodneyAnonymous
15 New Member
Wouldn't that entirely defeat the purpose of using multi-threading to begin with, though? Using a delegate to add the rows will just put the load back on the main thread, which will lock up the rest of the program.
Mar 19 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

4
4630
by: Frank Jona | last post by:
Intellisense with C# and a multi-file assembly is not working. With VB.NET it is working. Is there a fix availible? We're using VisualStudio 2003 Regards Frank
12
3842
by: * ProteanThread * | last post by:
but depends upon the clique: ...
0
3746
by: frankenberry | last post by:
I have multi-page tiff files. I need to extract individual frames from the multi-page tiffs and save them as single-page tiffs. 95% of the time I receive multi-page tiffs containing 1 or more black...
6
8137
by: cody | last post by:
What are multi file assemblies good for? What are the advantages of using multiple assemblies (A.DLL+B.DLL) vs. a single multi file assembly (A.DLL+A.NETMODULE)?
6
4870
by: Joe | last post by:
I have 2 multi-list boxes, 1 displays course categories based on a table called CATEGORIES. This table has 2 fields CATEGORY_ID, CATEGORY_NAME The other multi-list box displays courses based on...
4
17821
by: mimmo | last post by:
Hi! I should convert the accented letters of a string in the correspondent letters not accented. But when I compile with -Wall it give me: warning: multi-character character constant Do the...
5
5964
by: Shane Story | last post by:
I can seem to get the dimensions of a frame in a multiframe tiff. After selecting activeframe, the Width/Height is still really much larger than the page's actual dimensions. When I split a...
5
5703
by: bobwansink | last post by:
Hi, I'm relatively new to programming and I would like to create a C++ multi user program. It's for a project for school. This means I will have to write a paper about the theory too. Does anyone...
5
3236
by: dkelly925 | last post by:
Is there a way to add an If Statement to the following code so if data in a field equals "x" it will launch one report and if it equals "y" it would open another report. Anyone know how to modify...
0
2296
by: Sabri.Pllana | last post by:
We apologize if you receive multiple copies of this call for papers. *********************************************************************** 2008 International Workshop on Multi-Core Computing...
0
7110
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7314
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7372
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7482
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5623
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
3191
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3179
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1540
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
758
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.