Click here to Skip to main content
15,886,873 members
Home / Discussions / C#
   

C#

 
AnswerRe: how can i set windows form over other programs at the desktop in c# Pin
Dave Kreskowiak8-Mar-18 4:16
mveDave Kreskowiak8-Mar-18 4:16 
Questionapple push notification Pin
Member 108437285-Mar-18 20:22
Member 108437285-Mar-18 20:22 
AnswerRe: apple push notification Pin
Pete O'Hanlon5-Mar-18 20:28
mvePete O'Hanlon5-Mar-18 20:28 
GeneralRe: apple push notification Pin
Member 108437285-Mar-18 20:35
Member 108437285-Mar-18 20:35 
GeneralRe: apple push notification Pin
Pete O'Hanlon5-Mar-18 20:54
mvePete O'Hanlon5-Mar-18 20:54 
GeneralRe: apple push notification Pin
Member 108437285-Mar-18 21:11
Member 108437285-Mar-18 21:11 
GeneralRe: apple push notification Pin
Gerry Schmitz6-Mar-18 5:58
mveGerry Schmitz6-Mar-18 5:58 
QuestionTaskFactory Class Pin
Member 137105305-Mar-18 16:37
Member 137105305-Mar-18 16:37 
New to C# and want to know the best way to use the TaskFactory class and how to make sure I am populating my dataGridView rows correctly. Right now, I am only seeing a value in the last dataGridView row. Example: (If I have 3 dataGridView rows I am trying to populate, I only see the output in the 4th unpopulated row.) So, my question is: Am I using TaskFactory correctly and in the most efficient way and how do I make sure I am populating my dataGridView rows correctly. I am using .NET 4.5.51209 and VS 2010
if (dataGridView1.Rows.Count > 1)
{
   for (int index = 0; index < dataGridView1.Rows.Count-1; index++)
   {
       string gridDevice = dataGridView1.Rows[index].Cells[0].Value.ToString();
       string service = comboBox1.Text;
                    
       WebClient web = new WebClient();
       web.UseDefaultCredentials = true;

       List<Task> tasks = new List<Task>();
       tasks.Add(Task.Factory.StartNew(() =>
       {                       
           System.IO.Stream stream = web.OpenRead("http://<some 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[index].Cells[5].Value = package1[1];
           }
           else
           {
               dataGridView1.Rows[index].Cells[5].Value = "N/A";
           }

       }));
   }
}

AnswerRe: TaskFactory Class Pin
Pete O'Hanlon5-Mar-18 20:20
mvePete O'Hanlon5-Mar-18 20:20 
GeneralRe: TaskFactory Class Pin
Member 137105307-Mar-18 6:13
Member 137105307-Mar-18 6:13 
AnswerRe: TaskFactory Class Pin
Gerry Schmitz7-Mar-18 7:40
mveGerry Schmitz7-Mar-18 7:40 
GeneralRe: TaskFactory Class Pin
Member 1371053019-Mar-18 18:00
Member 1371053019-Mar-18 18:00 
Questionc# parsing CAN dbc files Pin
Member 135713645-Mar-18 4:05
Member 135713645-Mar-18 4:05 
AnswerRe: c# parsing CAN dbc files Pin
Maciej Los5-Mar-18 20:27
mveMaciej Los5-Mar-18 20:27 
GeneralRe: c# parsing CAN dbc files Pin
Member 135713645-Mar-18 20:34
Member 135713645-Mar-18 20:34 
Questiontextbox input Pin
User 136751143-Mar-18 13:01
User 136751143-Mar-18 13:01 
AnswerRe: textbox input Pin
BillWoodruff3-Mar-18 14:31
professionalBillWoodruff3-Mar-18 14:31 
GeneralRe: textbox input Pin
User 136751143-Mar-18 23:56
User 136751143-Mar-18 23:56 
GeneralRe: textbox input PinPopular
OriginalGriff4-Mar-18 1:21
mveOriginalGriff4-Mar-18 1:21 
GeneralRe: textbox input Pin
BillWoodruff4-Mar-18 2:18
professionalBillWoodruff4-Mar-18 2:18 
GeneralRe: textbox input Pin
Luc Pattyn4-Mar-18 7:19
sitebuilderLuc Pattyn4-Mar-18 7:19 
GeneralRe: textbox input Pin
OriginalGriff4-Mar-18 19:27
mveOriginalGriff4-Mar-18 19:27 
GeneralRe: textbox input Pin
Pete O'Hanlon4-Mar-18 20:56
mvePete O'Hanlon4-Mar-18 20:56 
GeneralRe: textbox input Pin
OriginalGriff4-Mar-18 21:04
mveOriginalGriff4-Mar-18 21:04 
GeneralRe: textbox input Pin
Pete O'Hanlon4-Mar-18 21:10
mvePete O'Hanlon4-Mar-18 21:10 

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.