请帮助我如何使用线程 [英] Please help me how to use threading

查看:70
本文介绍了请帮助我如何使用线程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨...朋友

任何人都可以帮助我如何在我的条件下使用线程.

Q.1 在某些情况下,例如Name ="John",我必须从.net插入表中的值.
名称将由用户在文本框中键入.现在我想知道如何在使用线程的同时从文本框中获取文本.我想使用一个线程进行插入,因为如果有大量的行,那么sql需要30秒.

Q.2 如何使用另一个线程从表中检索数据.我的意思是说,在将其提供给datagridview的同时检索之后,应该检查Datagridview的Invokerequired属性.

Q.3 检索数据后,我想在datagridview中显示它.但是我想将数值朝向datagridview的右侧排列,并且小于10的数量应以红色高亮显示.这将在单独的线程中完成
,因为如果数据量很大,这也会花费很多时间.

Q4 告诉我如何一个接一个地调用这些线程.如果我初始化thread1并启动它,然后初始化它下面的第二个线程并启动它,那么它将执行第二个线程,然后完成如下所示的

线程thr1 =新线程(新ThreadStart(this.insertingValues));
thr1.start();

线程thr2 =新线程(新ThreadStart(this.Retreving));
thr2.start();


在启动thr1之后,它将初始化thr2线程,并在完成分配给thr1的工作之前启动thr2.

Q5 我已经启动了按钮Click上的进度栏.现在如何设置进度条marquespeed = 0.我是否必须再次检查进度栏的invokerequired.如果是的话,那么我将如何使用Form Invoke停止它.

请帮助我,我从最近3天开始一直坚持下去.
请帮助.....

如果有人想要我的代码,那么我可以邮寄我的代码.请帮助我.

Hi... Friends

can any one help me how to use Threads in My condition .

Q.1 I have to insert values in table from .net on some condition like where Name = ''John''
The name will be type by user in textbox. Now i want to know how to get text from textbox while using thread. I want to use one thread for inserting because if there is large amount of rows, then sql take 30 seconds.

Q.2 How to retrieve data from table using another thread. I mean to say after retrieving while providing it to datagridview should i check Datagridview''s Invokerequired property.

Q.3 After retrieving data i want to show it in datagridview. but i want to arrange the numeric values towards right side of datagridview and amount which is less than 10 should be highlited by red colour. This would be done in seperate thread
, because it also take lot of time if data is in large amount.

Q4 Tell me how to call these threads one by one. If I initialize thread1 and start it and i initialize second thread below it and start it then it execute second thread before completing first work as shown below

Thread thr1 = new Thread (new ThreadStart(this.insertingValues));
thr1.start();

Thread thr2 = new Thread (new ThreadStart(this.Retreving));
thr2.start();


after starting thr1 it initialize thr2 thread and starts thr2 before completing work assigned to thr1.

Q5 i have started Progress bar on button Click. Now How to set Progress bar marquespeed =0. should i have to again check Progress bar''s invokerequired. if yes then how i will stop it using Invoke of Form.

Please help me i have stuck to it from last 3 days..
Please help.....

If any one want my code then i can mail my code. Please help me.

推荐答案

检查我的多线程文章

简单的多线程应用程序 [
Check my multi-threading article

Simple mutlithreaded application[^]


我给您链接,希望对您有所帮助

C#中的工作线程 [使用C#进行多线程编程 [ .NET中的初学者指南:第1部分的n [
i am giving you links i hope it will help you

Worker Threads in C#[^]

Multithreaded Programming Using C#[^]

Beginners Guide to Threading in .NET: Part 1 of n[^]



这篇关于请帮助我如何使用线程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆