Click here to Skip to main content
15,790,917 members
Home / Discussions / C#
   

C#

 
AnswerRe: apple push notification Pin
Pete O'Hanlon5-Mar-18 21:28
subeditorPete O'Hanlon5-Mar-18 21:28 
GeneralRe: apple push notification Pin
Member 108437285-Mar-18 21:35
Member 108437285-Mar-18 21:35 
GeneralRe: apple push notification Pin
Pete O'Hanlon5-Mar-18 21:54
subeditorPete O'Hanlon5-Mar-18 21:54 
GeneralRe: apple push notification Pin
Member 108437285-Mar-18 22:11
Member 108437285-Mar-18 22:11 
GeneralRe: apple push notification Pin
Gerry Schmitz6-Mar-18 6:58
mveGerry Schmitz6-Mar-18 6:58 
QuestionTaskFactory Class Pin
Member 137105305-Mar-18 17:37
Member 137105305-Mar-18 17:37 
AnswerRe: TaskFactory Class Pin
Pete O'Hanlon5-Mar-18 21:20
subeditorPete O'Hanlon5-Mar-18 21:20 
GeneralRe: TaskFactory Class Pin
Member 137105307-Mar-18 7:13
Member 137105307-Mar-18 7:13 
Thanks Pete for responding! Yes, my code was working before trying the TaskFactory. I have removed the List of tasks and the code below is working. But, my issue is, I am not sure how to use the task in the for loop. Currently, this is taking about 5 seconds for 3 rows whether I use the Task or not. I am trying to figure out where to place it so I can do all three calls at one time and reduce the time from 5 seconds to 1.75 seconds, which is about what it takes for 1 row.

<pre>
if (dataGridView1.Rows.Count > 1)
{
for (int index3 = 0; index3 < dataGridView1.Rows.Count-1; index3++)
{
string gridDevice = dataGridView1.Rows[index3].Cells[0].Value.ToString();
string service = comboBox1.Text;
WebClient web = new WebClient();
web.UseDefaultCredentials = true;

Task tasks = Task.Factory.StartNew( () =>
{
System.IO.Stream stream = web.OpenRead("http://<website>");
StreamReader reader = new StreamReader(stream);
String holdHTML = reader.ReadToEnd();

Match mTitle = Regex.Match(holdHTML, ">" + service + "(.*?)<");
if (mTitle.Success)
{
string package = mTitle.Groups[0].Value;
string[] package1 = package.Split('>', '<');
dataGridView1.Rows[index3].Cells[5].Value = package1[1];
}
else
{
dataGridView1.Rows[index3].Cells[5].Value = "N/A";
}
});

tasks.Wait();
}
}</pre>
AnswerRe: TaskFactory Class Pin
Gerry Schmitz7-Mar-18 8:40
mveGerry Schmitz7-Mar-18 8:40 
GeneralRe: TaskFactory Class Pin
Member 1371053019-Mar-18 19:00
Member 1371053019-Mar-18 19:00 
Questionc# parsing CAN dbc files Pin
Member 135713645-Mar-18 5:05
Member 135713645-Mar-18 5:05 
AnswerRe: c# parsing CAN dbc files Pin
Maciej Los5-Mar-18 21:27
mveMaciej Los5-Mar-18 21:27 
GeneralRe: c# parsing CAN dbc files Pin
Member 135713645-Mar-18 21:34
Member 135713645-Mar-18 21:34 
Questiontextbox input Pin
User 136751143-Mar-18 14:01
User 136751143-Mar-18 14:01 
AnswerRe: textbox input Pin
BillWoodruff3-Mar-18 15:31
professionalBillWoodruff3-Mar-18 15:31 
GeneralRe: textbox input Pin
User 136751144-Mar-18 0:56
User 136751144-Mar-18 0:56 
GeneralRe: textbox input PinPopular
OriginalGriff4-Mar-18 2:21
mvaOriginalGriff4-Mar-18 2:21 
GeneralRe: textbox input Pin
BillWoodruff4-Mar-18 3:18
professionalBillWoodruff4-Mar-18 3:18 
GeneralRe: textbox input Pin
Luc Pattyn4-Mar-18 8:19
sitebuilderLuc Pattyn4-Mar-18 8:19 
GeneralRe: textbox input Pin
OriginalGriff4-Mar-18 20:27
mvaOriginalGriff4-Mar-18 20:27 
GeneralRe: textbox input Pin
Pete O'Hanlon4-Mar-18 21:56
subeditorPete O'Hanlon4-Mar-18 21:56 
GeneralRe: textbox input Pin
OriginalGriff4-Mar-18 22:04
mvaOriginalGriff4-Mar-18 22:04 
GeneralRe: textbox input Pin
Pete O'Hanlon4-Mar-18 22:10
subeditorPete O'Hanlon4-Mar-18 22:10 
QuestionHow to create a recursive lambda function ? Pin
Jesus Carroll2-Mar-18 13:26
professionalJesus Carroll2-Mar-18 13:26 
AnswerRe: How to create a recursive lambda function ? PinPopular
Eddy Vluggen2-Mar-18 13:32
professionalEddy Vluggen2-Mar-18 13:32 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.