Search Results

Search found 1 results on 1 pages for 'user3681442'.

Page 1/1 | 1 

  • How can i add to dataGridView1 a data to the last row/column?

    - by user3681442
    In top of form1 i did: private System.Timers.Timer _refreshTimer; private int _thisProcess; Then in the Form1 Load event: _thisProcess = Process.GetCurrentProcess().Id; InitializeRefreshTimer(); PopulateApplications(); Then the timer init method: void InitializeRefreshTimer() { _refreshTimer = new System.Timers.Timer(5000); _refreshTimer.SynchronizingObject = this; _refreshTimer.Elapsed += new System.Timers.ElapsedEventHandler(TimerToUpdate_Elapsed); _refreshTimer.Start(); } Then the timer elapsed event: void TimerToUpdate_Elapsed(object sender, System.Timers.ElapsedEventArgs e) { PopulateApplications(); } In the end the Populate method: void PopulateApplications() { dataGridView1.Rows.Clear(); foreach (Process p in Process.GetProcesses(".")) { if (p.Id != _thisProcess) { try { if (p.MainWindowTitle.Length > 0) { String status = p.Responding ? "Running" : "Not Responding"; dataGridView1.Rows.Add( p.MainWindowTitle, status); } } catch { } } } } The variable status show in the column2 but let's say i want that status will be display for each process/app in column5 ? How can i move it ? EDIT** Tried this: void PopulateApplications() { dataGridView1.Rows.Clear(); foreach (Process p in Process.GetProcesses(".")) { if (p.Id != _thisProcess) { try { if (p.MainWindowTitle.Length > 0) { var icon = Icon.ExtractAssociatedIcon(p.MainModule.FileName); Image ima = icon.ToBitmap(); img.Image = ima; img.HeaderText = "Image"; img.Name = "img"; String status = p.Responding ? "Running" : "Not Responding"; dataGridView1.Rows.Add(img, p.MainWindowTitle, status); } } catch { } } } } I moved the variable img to the top of the form. The problem is i see in each row this: DataGridViewImageColumn { Name=img, Index=-1 } And i don't see the icon it self. Why ?

    Read the article

1