Monday, December 18, 2006
'.NET: Introducing Generics in the CLR,'bloggerForm','scrollbars=no,width=475,height=300,top=175,left=75,status=yes,resizable=yes: "Generics are an extension of the CLR type system that allow developers to define types for which certain details are left unspecified. These details are specified when the code is referenced by consumer code, making for enhanced flexibility. Jason Clark explains how."
Thursday, December 07, 2006
How do I debug a custom action/installer class?
You can use one of the following methods:
Add a call in your code to System.Diagnostics.Debugger.Launch. This method opens Just-In-Time debugging and allows you to attach a new debugger to your code.
Add a call in your code to MessageBox.Show("Debug Me"). When the message box is shown, use Visual Studio to attach to the MessageBox process. Then place breaks (for Visual C# projects) or stops (for Visual Basic projects) in the code.
Set your debugging preferences to start InstallUtil.exe (which is located in \winnt\Microsoft.net\Framework\version) and pass it your assembly as a parameter. When you press F5, you hit your breakpoint. InstallUtil.exe will run your custom actions the same way that MSI does.
Add a call in your code to System.Diagnostics.Debugger.Launch. This method opens Just-In-Time debugging and allows you to attach a new debugger to your code.
Add a call in your code to MessageBox.Show("Debug Me"). When the message box is shown, use Visual Studio to attach to the MessageBox process. Then place breaks (for Visual C# projects) or stops (for Visual Basic projects) in the code.
Set your debugging preferences to start InstallUtil.exe (which is located in \winnt\Microsoft.net\Framework\version) and pass it your assembly as a parameter. When you press F5, you hit your breakpoint. InstallUtil.exe will run your custom actions the same way that MSI does.
Tuesday, August 23, 2005
DBDate, DBTime, DBTimeStamp, Date
System.Data.OleDb.OleDbType.DBDate = store date only in the database;
System.Data.OleDb.OleDbType.DBTime= store time only in the database;
>>> The wrong one
System.Data.OleDb.OleDbType.DBTimeStamp= store date&time only in the database;
>>> The right one
System.Data.OleDb.OleDbType.Date= store date&time only in the database;
Example:
this.oleDbDeleteCommand1.Parameters.Add(new System.Data.OleDb.OleDbParameter("Original_TradeTime", System.Data.OleDb.OleDbType.Date, 0, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "TradeTime", System.Data.DataRowVersion.Original, null));
System.Data.OleDb.OleDbType.DBTime= store time only in the database;
>>> The wrong one
System.Data.OleDb.OleDbType.DBTimeStamp= store date&time only in the database;
>>> The right one
System.Data.OleDb.OleDbType.Date= store date&time only in the database;
Example:
this.oleDbDeleteCommand1.Parameters.Add(new System.Data.OleDb.OleDbParameter("Original_TradeTime", System.Data.OleDb.OleDbType.Date, 0, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "TradeTime", System.Data.DataRowVersion.Original, null));
Thursday, May 19, 2005
Change color of one cell in the DataGrid control ( C#)
http://datawebcontrols.com/faqs/CustomizingAppearance/ConditionalFormatting.shtml
The DataGrid provides a plethora of properties that can be set to specify the DataGrid's formatting. For example, you can have each consecutive row of a DataGrid alternate between two different colors merely by setting the DataGrid's AlternatingItemStyle's BackColor property.
While the AlternatingItemStyle is a great way to apply different formatting for every other DataGrid row, oftentimes developers want to perform conditional formatting based on the value(s) of a DataGrid row. For example, imagine a DataGrid that displays a list of products, including the product's name and price. Perhaps you want to draw the user's attention to products that are at "bargain-basement" prices. Namely, if a product has a price less than, say, $10.00, you want to have that row highlighted.
This can be accomplished by providing an event handler for the DataGrid's ItemDataBound event. The ItemDataBound fires once for each DataGridItem added to the DataGrid (that is, it fires once for each row that is added to the DataGrid). Essentially, what we need to do is in this event handler, check to see if the price is below the threshold ($10.00, or whatever lower bound you choose). If it is, then we want to set the DataGridItem's BackColor property to Yellow, thereby highlighting the row.
The DataGrid provides a plethora of properties that can be set to specify the DataGrid's formatting. For example, you can have each consecutive row of a DataGrid alternate between two different colors merely by setting the DataGrid's AlternatingItemStyle's BackColor property.
While the AlternatingItemStyle is a great way to apply different formatting for every other DataGrid row, oftentimes developers want to perform conditional formatting based on the value(s) of a DataGrid row. For example, imagine a DataGrid that displays a list of products, including the product's name and price. Perhaps you want to draw the user's attention to products that are at "bargain-basement" prices. Namely, if a product has a price less than, say, $10.00, you want to have that row highlighted.
This can be accomplished by providing an event handler for the DataGrid's ItemDataBound event. The ItemDataBound fires once for each DataGridItem added to the DataGrid (that is, it fires once for each row that is added to the DataGrid). Essentially, what we need to do is in this event handler, check to see if the price is below the threshold ($10.00, or whatever lower bound you choose). If it is, then we want to set the DataGridItem's BackColor property to Yellow, thereby highlighting the row.
Monday, May 16, 2005
Sunday, May 15, 2005
DataSet Form Problems ( As always)
- When I used the Data Set Form Wizard in VS.NET 2003 to generate a dataset form, I got the error: "there were errors configuring the data adapter". My god, it happens again. I spent 1 hour to repeat the whole procedure and I spent 3o minutes on Internet to find out how other people say about it.
Finally I recalled the problem happend before:
- If a column name in the Access database is special (I am not clear how special it could be), it will have this problem.
So I check the column name, find one is called Symbol, which looks special. I changed it to ProductSymbol, Great! the dataset form wizard worked.
Finally I recalled the problem happend before:
- If a column name in the Access database is special (I am not clear how special it could be), it will have this problem.
So I check the column name, find one is called Symbol, which looks special. I changed it to ProductSymbol, Great! the dataset form wizard worked.
