2011年10月4日 星期二

[.Net] The type 'Microsoft.CompactFramework.Design.UnsafeUserControl' has no property named 'XXX'

I create a user control and it use another user control.
It met some problem when I view it's design and the saw the message,
The type 'Microsoft.CompactFramework.Design.UnsafeUserControl' has no property named 'XXX'

I follow the step as below to work around it,
1. In the Solution Explorer of VS2005, right click on the class file and 
select "View Class Diagram" (This will open the Class Diagram file). 

2. Select the class and open the Properties window. 

3. In the "Custom Attributes" field, click the browse button. A dialog 
will be displayed and enter the following: DesktopCompatible(true) 





Reference:
http://forum.soft32.com/pda/VS2005-Design-UnsafeUserControl-Error-ftopict60562.html

2011年10月3日 星期一

[.Net] Reading scrambled words in txt file

There is a txt file with Chinese words and I read it string by StreadReader.
I set encoding to default, but words still scrambled.


Solution:

I open the txt file and set encoding as Unicode then work well.