I have a datagrid in my c# windows application and my code is
private void BindGrid(SmsPdu pdu)
{
DataRow dr=dt.NewRow();
SmsDeliverPdu data = (SmsDeliverPdu)pdu;
dr[0]=data.OriginatingAddress.ToString();
dr[1]=data.SCTimestamp.ToString();
dr[2]=data.UserDataText;
dt.Rows.Add(dr);
dataGrid1.DataSource=dt;
}
And my datagrid looks like this
alt text http://www.freeimagehosting.net/uploads/c368f82e0e.jpg
- How to set width of all three columns
sender,time,Message?
the simple way: use autosize
otherwise, use the Columns collection to set the size of each column
ADDENDUM:
sorry, I assumed you were using DataGridView, since it replaced DataGrid in .NET 2.0
for DataGrid, it’s a little more complex – but google knows all!
http://www.syncfusion.com/faq/windowsforms/search/1004.aspx