in

SDT Community Server

SDT Forums, Blogs, Photos server.

Floating Heart

No description is bad.

Browse by Tags

All Tags » Win.Net (RSS)
  • C# Interactive Shell and C# Eval

    http://tirania.org/blog/archive/2008/Sep-10.html 一个很有趣的项目。
    Posted Nov 14 2008, 09:56 PM by wicky with | with no comments
    Filed under: ,
  • How to build an Office COM add-in by using Visual C# .NET

    http://support.microsoft.com/?kbid=302901 How to build an Office COM add-in by using Visual C# .NET View products that this article applies to. function loadTOCNode(){} Article ID : 302901 Last Review : May 11, 2007 Revision : 10.1 This article was previously published under Q302901 On This Page SUMMARY The IDTExensibility2 interface OnConnection OnDisconnection OnAddInsUpdate OnStartupComplete and OnBeginShutdown COM add-in registration How to build a COM add-in by using Visual C# .NET Step-by-step...
    Posted Sep 03 2008, 09:21 AM by wicky with | with 1 comment(s)
    Filed under:
  • Element Type of CLR

    et_unknown Undefined type. et_void ELEMENT_TYPE_VOID. et_boolean ELEMENT_TYPE_BOOLEAN, System.Boolean. et_char ELEMENT_TYPE_CHAR, System.Char. et_int8 ELEMENT_TYPE_I1, System.SByte. et_uint8 ELEMENT_TYPE_U1, System.Byte. et_int16 ELEMENT_TYPE_I2, System.Short. et_uint16 ELEMENT_TYPE_U2, System.UShort. et_int32 ELEMENT_TYPE_I4, System.Int. et_uint32 ELEMENT_TYPE_U4, System.UInt. et_int64 ELEMENT_TYPE_I8, System.Long. et_uint64 ELEMENT_TYPE_U8, System.ULong. et_float32 ELEMENT_TYPE_R4, System.Float...
    Posted Jun 28 2008, 10:21 AM by wicky with | with no comments
    Filed under: , ,
  • Creating great thumbnails in ASP.NET

    http://www.thebrainparasite.com/post/Creating-great-thumbnails-in-ASPNET.aspx Or refer to attached file.
    Posted May 27 2008, 02:21 PM by wicky with | with no comments
    Filed under: ,
  • How to make your Web Reference proxy URL dynamic

    A simple method, please refer to attached file.
    Posted Aug 30 2007, 10:20 PM by wicky with | with no comments
    Filed under: ,
  • 开发终端式短信的原理和方法

    http://blog.csdn.net/gztoby/archive/2004/09/21/112041.aspx 简介 没发过短信的年轻人肯定是属于那种受保护的稀有动物,通讯发达的今天短信已经成为人们交流的重要手段,其中也蕴含着巨大的市场和经济利益,掌握短信技术的人才也受到各大公司的追捧是目前职场上耀眼的明星。本文介绍了短信的原理和实现方法,重点说明了短信的编码方式、AT指令以及用C#实现串口通讯的方法。 前言 目前,主有三种发送短信的方式: 1、 网关方式:就是向当地的电信部门申请,不需要额外的设备,适用于大型的通信公司,像华为、傲天、中兴、亚信等。 2、 终端方式:就是借助像GSM MODEM之类的设置(支持AT指令的手机也行),通过数据线连接电脑,来发送短信,用这种方法比较适用于小型及个人。要实现这种方式必须理解串口通信、AT指令、短信编码、解码,这也是本文讨论的重点。 3、 利用一些网站来实现,方式简单,不过对网站依赖性太高,对网络的要求也比较高,非常不适于进行项目开发 阅读导航 终端短信连接示意图 原理篇 短信编码 AT指令 串口通讯 实践篇 常见问题 下载 本文源代码 编码测试文件...
    Posted Jun 23 2007, 04:30 PM by wicky with | with no comments
    Filed under:
  • Scroll to Bottom of TextBox

    有时我们想在textbox内容改变后,自动滚动到最后一行。一下就是解决方案: 方法1: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 [DllImport( "User32.dll" , CharSet = CharSet.Auto, EntryPoint = "SendMessage" )] static extern IntPtr SendMessage(IntPtr hWnd, uint Msg, IntPtr wParam,IntPtr lParam); public static void ScrollToBottom(TextBoxBase tb) { const int WM_VSCROLL = 277; const int SB_BOTTOM = 7; IntPtr ptrWparam = new IntPtr(SB_BOTTOM); IntPtr ptrLparam = new IntPtr(0); SendMessage(tb.Handle, WM_VSCROLL, ptrWparam, ptrLparam); } 方法2: 1 2 3 4 5 public...
    Posted Jun 15 2007, 08:41 AM by wicky with | with no comments
    Filed under: ,
  • ORA-02041: client database did not begin a transaction

    When using OracleClient connect to Oracle 8i and using database link, error "ORA-02041: client database did not begin a transaction" occur even for single select statement. This is unfortunately a known problem, there is a QFE ready which you can get by contacting PSS for Q830173, you also need to add a new keyword to the connection string, (please verify with PSS what the actual string is). As part of this workaround you cannot use Distributed Transactions on that particular connection...
    Posted Jun 07 2007, 08:09 PM by wicky with | with no comments
    Filed under: , ,
  • ActiveReports: Using Custom Paper Sizes

    http://www.datadynamics.com/forums/696/ShowPost.aspx The manner in which an ActiveReport is rendered is dictated by the print driver. If the printer you've explicitly assigned for the report (or the default printer for the machine it's being run on if none was assigned) does not support the paper size you've chosen, ActiveReports will render the report on the printer's default paper size. If you need your report to show on a custom paper size not supported by the printer, you can...
    Posted May 29 2007, 10:30 AM by wicky with | with 1 comment(s)
    Filed under: ,
  • UnicodeEncoding behavior in .Net 1.x and 2.0

    In .Net 1.x, we used to call UnicodeEncoding.GetString(byte[]) to convert byte array to string, and then call UnicodeEncoding.GetBytes(string) to convert it back to byte array. In .Net 2.0, this approach doesn't work anymore, it's because .Net 2.0 adds some checking to prevent invalid bytes from being converted to string. So after the roundtrip, you may lose something and cannot get the original bytes back. Here is a good post which discussed this issue and gave a suggestion: Don't Roundtrip...
    Posted May 25 2007, 08:29 AM by wicky with | with no comments
    Filed under: ,
  • Remove Previous Setting in C#

    .Net 2005提供了一个非常方便的System.Setting,默认的Provider是LocalFileSettingsProvider。 可以为每一个用户保存自己的应用程序设置。 但是这个Setting是按版本分目录保存的,也就是每一次版本号的改变都会生成一个新的目录和用户文件。 居然找不到删除历史版本的方法。 经过研究,Setting类的内部有一个私有的GetPreviousConfigFileName方法, 可以利用Reflection调用它达到目的。 下面是示例代码: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 //upgrade user setting to new version Settings.Default.Upgrade(); //try to remove previous setting LocalFileSettingsProvider lfsp = Settings.Default.Providers[ ...
    Posted May 23 2007, 01:42 PM by wicky with | with 1 comment(s)
    Filed under:
  • Cut Image with C#

    Here is a sample which cut a png image to 16X16 bmp files: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 string path = @"e:\\Class.Browser16.png" ; Image large = Image.FromFile(path, true ); int x = 0; int y = 0; int width = 16; int height = 16; int count = large.Width / width; Bitmap bmp = new Bitmap(width, height); Graphics g = Graphics.FromImage(bmp); for ( int i = 0; i < count; i++ ) { g.Clear(Color.Transparent); g.DrawImage(large, new Rectangle(0, 0, width, height), new Rectangle...
    Posted May 21 2007, 05:45 PM by wicky with | with no comments
    Filed under: ,
  • XtraGrid Column Header Click

    https://www.devexpress.com/Support/Center/ViewIssue.aspx?issueid=B968&searchtext=click+column+header&pgid=ecb3be56-c75a-4166-aa68-cb462cd2dd2b&pid=382e0f17-f133-4866-aa3f-aeb2f50b59b7 Description Created by MarkSF at 12/8/2005 11:38:12 AM How can I capture mouse click s on the column header s in a XtraGrid? Resolved (Answered) by Developer Express Team at 12/9/2005 5:43:41 AM You should use the CalcHitInfo method of your grid view to determine a grid element at a given position. Here...
    Posted Apr 24 2007, 09:31 PM by wicky with | with 1 comment(s)
    Filed under:
  • How to enable the word-wrap feature for the captions of columns for XtraGrid

    https://www.devexpress.com/Support/Center/ViewKBIssue.aspx?kbid=A250&searchtext=caption+wrap&pgid=ecb3be56-c75a-4166-aa68-cb462cd2dd2b&pid=382e0f17-f133-4866-aa3f-aeb2f50b59b7 How to enable the word- wrap feature for the caption s of columns Article ID: A250 ; Product Group: .NET ; Product: XtraGrid ; Version(s): 3, 6.x ; Modified On: 20 Dec 2006 Description Can I make the grid display multiline text in column headers? A column's caption may be too long to fit the column's width. Solution...
    Posted Apr 13 2007, 09:24 AM by wicky with | with no comments
    Filed under:
  • Toolbar, Focus and Validation

    通常一个控件在离开焦点的时候,才会触发Validation事件,而Toolbar是不会获得焦点的,所以在输入空间输入了某些内容,直接点Toolbar按钮,当前输入的内容可能并没有更新到控件的相关属性,或者是DataSource里面。 比如RichTextBox,在没用DataBinding (Rtf)的时候,程序里赋SelectedText,改变会更新到Text属性,如果使用了DataBinding (Rtf),改变就不会更新到Text属性,太奇怪了。当然,在没有离开焦点的时候,Text的改变不会更新到DataSource。 我们可以使用以下函数解决这个问题: 1) 调用相关Container的ValidateChildren 方法 (强制控件进行Validation) 2) 调用相关控件的BindingContext[].EndCurrentEdit方法 (强制把变动更新到DataSource) 另外可以参考本人 另外一篇关于DataSourceUpdateMode的文章
    Posted Mar 21 2007, 08:52 AM by wicky with | with no comments
    Filed under: ,
  • Page.Cache, HttpContext.Cache, HttpRuntime.Cache的区别

    其实都是引用的同一样东西,通过Reflector可以看到,Page.Cache引用的是HttpContext.Cache,HttpContext.Cache引用的是HttpRuntime.Cache。前2的存在只是为了使用的方便而以。 由于Page和Context不是在任何环境都可用,HttpRuntime.Cache应该是最好的选择。 SimpleCache就是HttpRuntime.Cache的简单包装。 有种说法是HttpContext.Cache是页面相关的,由代码看,这个说法是错误的。 它们都指向同一个实例,范围是Application。
    Posted Feb 28 2007, 02:49 PM by wicky with | with no comments
    Filed under: ,
  • XtraGrid: How to filter a second LookUp column based on a first LookUp column's value

    https://www.devexpress.com/Support/Center/ViewKBIssue.aspx?kbid=A237&searchtext=lookupedit+datasource&pgid=ecb3be56-c75a-4166-aa68-cb462cd2dd2b&pid=382e0f17-f133-4866-aa3f-aeb2f50b59b7 Description Let's assume that there is an XtraGrid with two combo boxes (dropdown lists) in one row. The list items of the second combo depends upon the current value of the first combo. If a user selects any value in the first combo, the second combo must filter its list items. Is this possible to implement...
    Posted Feb 13 2007, 11:43 AM by wicky with | with 1 comment(s)
    Filed under: ,
  • 关于初次DataBind的时候会触发ValueChanged事件的问题

    由于MS Binding的机制的影响,在ShowDialog的时候,数据绑定的相关控件会触发ValueChanged事件。 对于XtraEditors,会触发EditValueChanged事件。 但是这个是我们不期望的,因为他只相当于Form的初始化。 一个解决办法就是在Form Load事件里面邦定EditValueChanged事件, 而不在InitializeComponent里面绑定。 这样第一次的数据绑定将不会激发EditValueChanged事件。
    Posted Feb 13 2007, 11:26 AM by wicky with | with no comments
    Filed under: ,
  • DataSourceUpdateMode in DataBinding

    有时我们希望在控件的值一修改就更新绑定的数据源。但是默认的DataBinding却不会这样做。 因为默认的DataSourceUpdateMode是OnValidation,一般也就是在离开焦点的时候才做这件事。 如果用DevExpress的XtraEditors,通常有几种方法: 1) call BaseEdit.DoValidate方法 2) call BindingContext[].EndCurrentEdit方法 3) 绑定的时候将DataSourceUpdateMode设置成OnPropertyChanged 例如: luePayTerms.DataBindings.Add("EditValue", dt, "PAYTERMS", false, DataSourceUpdateMode.OnPropertyChanged ); 某些情况下,由于MS Binding机制的关系,可能只有第3)种方法可用。 比如在LookupEdit的EditValueChanged事件里面就是这样的。
    Posted Feb 13 2007, 11:18 AM by wicky with | with 3 comment(s)
    Filed under: , ,
  • 如何得到硬盘序列号?.NET版本[C#]

    http://study.pay500.com/4/s44901.htm 硬盘序列号(Serial Number)不等于卷标号(Volume Name),后者虽然很容易得到,但是格式化分区后就会重写,不可靠。遗憾的是很多朋友往往分不清这一点。 要得到硬盘的物理序列号,可以通过WMI,也就是Win32_PhysicalMedia.SerialNumber。可惜的是Windows 98/ME的WMI并不支持这个类,访问时会出现异常。 受陆麟的例子的启发,我们还可以通过S.M.A.R.T.接口,直接从RING3调用API DeviceIoControl()来获取硬盘信息,而不需要写VXD或者DRIVER。这样这个问题就解决了,我对它进行了封装,大量使用了P/Invoke技术,一个完整的Library。支持Windows 98-2003。 使用上很简单: HardDiskInfo hdd = AtapiDevice.GetHddInfo(0); // 第一个硬盘 Console.WriteLine("Module Number: {0}", hdd.ModuleNumber); Console...
    Posted Feb 07 2007, 11:46 AM by wicky with | with no comments
    Filed under: , ,
  • Error: The constructor to deserialize an object of type 'XXX' was not found.

    You implement ISerializable interface. using System.Runtime.Serialization; [Serializable] class YourClassName { ... } You MUST wrote in your derived class this protected constructor for deserialization without any implementation. protected YourClassName(SerializationInfo info, StreamingContext context) :base(info,context){} Now you can serialize and deserialize your collection.
    Posted Nov 06 2006, 03:51 PM by wicky with | with no comments
    Filed under: , ,
  • C#编程:时间格式的转换

    http://dotnet.chinaitlab.com/CSharp/525282.html 有时候我们要对时间进行转换,达到不同的显示效果 默认格式为:2005-6-6 14:33:34 如果要换成成200506,06-2005,2005-6-6或更多的该怎么办呢 我们要用到:DateTime.ToString的方法(String, IFormatProvider) using System; using System.Globalization; String format="D"; DateTime date=DataTime,Now; Response.Write(date.ToString(format, DateTimeFormatInfo.InvariantInfo)); 结果输出 Thursday, June 16, 2005 参数format格式详细用法 格式字符 关联属性/说明 d ShortDatePattern D LongDatePattern f 完整日期和时间(长日期和短时间) F FullDateTimePattern(长日期和长时间) g 常规(短日期和短时间...
    Posted Sep 22 2006, 04:56 PM by wicky with | with 1 comment(s)
    Filed under: , ,
  • Guest帐号和错误Access to the path 'Global\.net clr networking' is denied

    在Windows中用guest运行.net程序,在访问网络的时候会出现错误Access to the path 'Global\.net clr networking' is denied。 .net clr networking实际上是.net的性能计数器,用来记录所有.net(非asp.net)程序的数据发送和接收情况。 Access to the path 'Global\.net clr networking' is denied. at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) at System.Threading.Mutex.<>c__DisplayClass3.<.ctor>b__0(Object userData) at System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode...
    Posted Aug 27 2006, 01:35 PM by wicky with | with no comments
    Filed under:
  • .Net执行带参数的Oracle命令产生的问题

    使用OracleClient,用Command执行带参数的Sql语句时,往往会产生古怪的问题,特别是参数是针对Varchar2类型的字段并且更新Unicode字符串的时候(如中文)。 如: ORA-01461: can bind a LONG value only for insert into a LONG column 如果根据错误信息,误以为设置DbType可以解决问题的话,可能会发生其他错误,如: ORA-12571: TNS:packet writer failure 甚至进程死掉。 这个问题由来已久,但是网上找不到很好的解决方案。 错误可能出现也可能不出现。比如在IDE下启动就OK,在IE里面启动就出错。 临时的解决方法是对Unicode字符串只有不用参数形式传递。
    Posted Aug 25 2006, 05:48 PM by wicky with | with no comments
    Filed under: ,
  • AssemblyName.GetAssemblyName

    这个方法可以获得打开某个Assembly文件,获得AssemblyName,随即释放。不会加载到当前的AppDomain。
    Posted Aug 02 2006, 01:48 PM by wicky with | with no comments
    Filed under: ,
  • 使用非默认的Oracle Client

    CDA需要使用Oracle 10g Client,而同一台机器上的其他程序暂时都是使用Oracle 8i Client,默认Client是Oracle 8.1.7。如何是好呢? 一个简单的解决方案: Web.config: <appSettings> <add key="oracleClientPath" value="c:\oracle\ora10g\bin" /> </appSettings> Global.asax: void Application_Start( object sender, EventArgs e) { Application.Lock(); ... string oracle = Config.OracleClientPath; if (!String.IsNullOrEmpty(oracle)) { string path = Environment.GetEnvironmentVariable( "path" ); path = String.Format( "{0}{1}{2}" , oracle, (oracle[oracle...
    Posted Jun 28 2006, 04:59 PM by wicky with | with no comments
    Filed under: , ,
  • C#中的Nullable Type和??操作符

    The ?? operator returns the left-hand operand if it is not null, or else it returns the right operand. 以前我们会这么写: string param = Request.Params[ "param" ]; if ( param == null ) { param = defaultValue; } 或 string param = Request.Params[ "param" ] == null ? defaultValue : Request.Params[ "param" ]; 现在这么写就可以了: string params = Reqeust.Params[ "param" ] ?? defaultValue; 够简单了吧。 定义Nullable Type: int? a = null; int b = 1; int c = a??0 + b;
    Posted Jun 14 2006, 10:47 PM by wicky with | with 1 comment(s)
    Filed under: , ,
  • ActiveReports : How to Remove the Evaluation Banner Once a License is Purchased

    If you are seeing the evaluation banner, but have purchased a license for the product, this article will take you step by step through trouble shooting the problem. Have you run the licensing executable on your machine? There is a licensing executable which is distributed with the product (License.exe, LicensePro.exe, LicenseStd2.exe, or LicensePro2.exe). When this executable is run you will be prompted for your name, company name, and serial number. You can verify that the machine has been properly...
Copyright SDT, 2006-2009. All rights reserved.