DataSET rename columns and autformat width size
In my N Tier application, I have a dataset with following code:
try
{
int acid;
acid = Convert.ToInt32(textBoxActivityNumber.Text);
_localds = new DataSet("CRMBCC");
_localds = myActivity.GetAllServiceRequestsFromActivity(acid);//acid
dataGridViewActivityServiceRequest.DataSource = _localds.Tables[0];
//Make unvisible columns
dataGridViewActivityServiceRequest.Columns["ActivityId"].Visible = false;
dataGridViewActivityServiceRequest.Columns["ServiceRequestId"].Visible = false;
dataGridViewActivityServiceRequest.Columns["ActivityServiceRequestId"].Visible = false;
dataGridViewActivityServiceRequest.Columns["Description"].Visible = false;
dataGridViewActivityServiceRequest.Columns["Comments"].Visible = false;
dataGridViewActivityServiceRequest.Columns["OperationNumber"].Visible = false;
dataGridViewActivityServiceRequest.Columns["ProductId"].Visible = false;
dataGridViewActivityServiceRequest.Columns["ProductId1"].Visible = false;
dataGridViewActivityServiceRequest.Columns["Active"].Visible = false;
dataGridViewActivityServiceRequest.Columns["Type"].Visible = false;
dataGridViewActivityServiceRequest.Columns["Line"].Visible = false;
//Order columns
dataGridViewActivityServiceRequest.Columns["ServiceRequestId1"].DisplayIndex = 1;
dataGridViewActivityServiceRequest.Columns["Area"].DisplayIndex = 2;
dataGridViewActivityServiceRequest.Columns["SubArea"].DisplayIndex = 3;
dataGridViewActivityServiceRequest.Columns["Name"].DisplayIndex = 4;
dataGridViewActivityServiceRequest.Columns["Priority"].DisplayIndex = 5;
dataGridViewActivityServiceRequest.Columns["Status"].DisplayIndex = 6;
dataGridViewActivityServiceRequest.Refresh();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Activity Service Requests",
MessageBoxButtons.OK, MessageBoxIcon.Error);
}
Now I would like to give the visible columns another more meaningfull name AND I would like to autoformat the width of the columns?
Can someone help me with this?
Kind regards!!