I am working on a windows form application in C# , I have a data grid view which its DataSource is coming from a DataTable just like this
DataTable table = projectsOperations.GetPaymentsByProjectId(this.ProjectID);
dgvShowPaymentsOfProject.DataSource = table;
now i need to change the width of the column number 7 in the DataGridView i have tried this :
dgvShowPaymentsOfProject.Columns[7].Width = 200;
but i gives me an exception "Object reference not set to an instance of an object" can you guys please help?