将数据从字符串传输到数据视图

时间:2011-06-21 15:54:48

标签: c# .net windows string

我正在尝试将数据从字符串传输到数据视图控件,有人可以演示如何完成此操作:

 private void testing_Click(object sender, EventArgs e)
        {
            // Get a ScheduledTasks object for the computer named "DALLAS"
            string machineName = (@"\\" + System.Environment.MachineName);
            ScheduledTasks st = new ScheduledTasks(machineName);
            // Get an array of all the task names
            string[] taskNames = st.GetTaskNames();
            st.Dispose();
        }

1 个答案:

答案 0 :(得分:0)

for (int i = 0; i < taskNames.Count; i++)
{
    dataGridView1.Rows.Add(taskNames[i]);    
}