Click here to Skip to main content
16,003,873 members
Home / Discussions / C#
   

C#

 
AnswerRe: help me TAPI using C#.net Pin
Judah Gabriel Himango24-Dec-06 9:09
sponsorJudah Gabriel Himango24-Dec-06 9:09 
GeneralRe: help me TAPI using C#.net Pin
nina nini25-Dec-06 7:34
nina nini25-Dec-06 7:34 
Questionmdi form problem Pin
Harikrk23-Dec-06 7:53
Harikrk23-Dec-06 7:53 
Questionhow to Send/Recive Fax from VC# 2005 ? Pin
hdv21223-Dec-06 7:04
hdv21223-Dec-06 7:04 
AnswerRe: how to Send/Recive Fax from VC# 2005 ? Pin
Judah Gabriel Himango24-Dec-06 9:13
sponsorJudah Gabriel Himango24-Dec-06 9:13 
Questionallocate percentage to each selected user Pin
fmardani23-Dec-06 6:17
fmardani23-Dec-06 6:17 
AnswerRe: allocate percentage to each selected user Pin
saqib8223-Dec-06 9:21
saqib8223-Dec-06 9:21 
QuestionChanging Datagrid elements programmically in C# Pin
Vernware23-Dec-06 5:29
Vernware23-Dec-06 5:29 
I am using the Datagrid form control in C#.net environment. I have no problem binding the datagrid to the datasource and displaying the table I want to display. But I am having a problem changing some of the grid elements using code after I have displayed the control.

For example, there are some columns that need the width changed. I have not been able to change any of the grid elements/properties at all.

Here is the code that displays the grid and its data:


------------------------------------------------------------------------------
DataSet aDataSet = new DataSet();
OleDbDataAdapter aAdaptor;
aSqlQuery = "SELECT * From Employee";
aConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;User ID='Admin';Data Source=CSharpDataGrid.mdb;";

aConnection = new OleDbConnection(aConnectionString);
aAdaptor = new OleDbDataAdapter(aSqlQuery, aConnection);
aAdaptor.Fill(aDataSet);
this.dgEmployee.DataSource = aDataSet.Tables[0];
--------------------------------------------------------------------------

As I said, this code brings up the control with the data loaded. Now I am trying to change the width of one column:

--------------------------------------------------------------------------
DataGridTableStyle EmployeeTableStyle = new DataGridTableStyle();
EmployeeTableStyle.MappingName = "Employee";

DataGridColumnStyle ColumnFullName = new DataGridTextBoxColumn();
ColumnFullName.MappingName = "Name";
ColumnFullName.HeaderText = "Full Name";
ColumnFullName.Width = 5;
EmployeeTableStyle.GridColumnStyles.Add(ColumnFullName);
-----------------------------------------------------------------------



This code has no effect on the displayed grid. I would expect the DataGridTableStyle to be associated with the Employee table in the grid dataset. And then I would expect the column “Name” would change as per the above code. But nothing happens.

Would appreciate any tips on how to change row and column properties (width, color, selection status, etc) using C# code.

Thanks, Vern



Vern
AnswerRe: Changing Datagrid elements programmically in C# Pin
gnadeem23-Dec-06 12:33
gnadeem23-Dec-06 12:33 
GeneralRe: Changing Datagrid elements programmically in C# Pin
Vernware24-Dec-06 5:16
Vernware24-Dec-06 5:16 
QuestionHow print over COM and LPT Pin
Savanora23-Dec-06 2:03
Savanora23-Dec-06 2:03 
Questionunable to access the from server Pin
jayraj todkar23-Dec-06 1:44
jayraj todkar23-Dec-06 1:44 
AnswerRe: unable to access the from server Pin
WillemM23-Dec-06 6:07
WillemM23-Dec-06 6:07 
Questionhow to create dynamic crystal report in c#.net Pin
jaganil23-Dec-06 1:17
jaganil23-Dec-06 1:17 
AnswerRe: how to create dynamic crystal report in c#.net Pin
WillemM23-Dec-06 6:08
WillemM23-Dec-06 6:08 
QuestionHow to bind arraylist to a datatable in C#.Net Pin
NK723-Dec-06 0:01
NK723-Dec-06 0:01 
AnswerRe: How to bind arraylist to a datatable in C#.Net Pin
jaganil23-Dec-06 2:32
jaganil23-Dec-06 2:32 
QuestionHosting a Windows Forms Control in a MFC ActiveX control Pin
sps-itsec4622-Dec-06 23:27
sps-itsec4622-Dec-06 23:27 
AnswerRe: Hosting a Windows Forms Control in a MFC ActiveX control Pin
sps-itsec463-Jan-07 1:17
sps-itsec463-Jan-07 1:17 
QuestionUnicode MSI Pin
MHASSANF22-Dec-06 22:15
MHASSANF22-Dec-06 22:15 
Questionhow to program the barcode reader? Pin
yousafzai22-Dec-06 21:09
yousafzai22-Dec-06 21:09 
AnswerRe: how to program the barcode reader? Pin
Colin Angus Mackay23-Dec-06 1:40
Colin Angus Mackay23-Dec-06 1:40 
GeneralRe: how to program the barcode reader? Pin
gnadeem23-Dec-06 11:33
gnadeem23-Dec-06 11:33 
GeneralRe: how to program the barcode reader? Pin
Colin Angus Mackay23-Dec-06 11:38
Colin Angus Mackay23-Dec-06 11:38 
QuestionComposite design pattern = polymorphism? Pin
[DK]KiloDunse22-Dec-06 21:03
[DK]KiloDunse22-Dec-06 21:03 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.