In Visual Studio 2015 community, I'm creating a winforms application with C#. In this project, I've created a class that looks like this:
public class EDIFile
{
public string fullInFilePath { get; set; }
public string fullOutFilePath { get; set; }
public string InfileName { get; set; }
public string OutfileName { get; set; }
public string UniqueID { get; set; }
public DateTime infileDateTime { get; set; }
public DateTime outfileDateTime { get; set; }
public TimeSpan timeDiff { get; set; }
}
I've compiled a list of this class. I'd want to have a gridview that is populated with the contents of this list after it's loaded. I checked online for a solution and found a few, but none of them worked for me. If you are able, please provide me with some clear instructions.
I still haven't figured out how to make it work for me. Based on the two responses, here is the code I've come up with so far:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace ProviderPayProject1
{
public partial class Form2 : Form
{
public Form2()
{
InitializeComponent();
}
private void Form2_Load_1(object sender, List<EDIFile> EDIFiles)
{
DataGridView dataGridView1 = new DataGridView();
dataGridView1.AutoGenerateColumns = true;
Controls.Add(dataGridView1);
dataGridView1.DataSource = EDIFiles;
}
}
}
This is the code for "form2," which is invoked by "form1." All "form2" should do is load and populate a datagridview with data from a list supplied to it. Please assist me in determining what I'm doing incorrectly.