I am creating an application that uses a DataGridView to create and modify a local list that will later be imported into the system. It must be editable by the user (click and write to DGV), and it must also support import from csv, which means that I need two-way synchronization between DGV and the data source.
I installed the DGV DataSource in the BindingList<Client>following way:
public class Client
{
private string _name;
private string _mac;
private string _status;
public Client(string pcnavn, string MAC)
{
_pcnavn = pcnavn;
_mac = mac;
}
public string Name
{
get
{
return _name;
}
set
{
_name = value;
}
}
public string MAC
{
get
{
return _mac;
}
set
{
_mac = value;
}
}
public string Status
{
get
{
return _status;
}
set
{
_status = value;
}
}
}
public BindingList<Client> clientDataSource = new BindingList<Client>();
public MainForm()
{
InitializeComponent();
clientDataGridView.DataSource = clientDataSource;
}
DGV, ( ), DGV. DataSource , SQL, DGV. " ", ? , , .
AllowUserToAddRows AllowUserToDeleteRows true.
. " " . , DGV.
