Time of Update: 2018-12-05
2010-03-18 10:50:55 1.設定檔web.config中 在節中加上整個網站的編碼方式。<globalization fileEncoding="GB2312" requestEncoding="GB2312" responseEncoding="GB2312"/>這樣參數就以gb2312的中文編碼方式傳輸了。而一般預設是utf-8.2.在傳參是先編碼在傳輸,接受時先編碼,在接收。string
Time of Update: 2018-12-05
CodeCode highlighting produced by Actipro CodeHighlighter
Time of Update: 2018-12-05
感謝http://blog.csdn.net/alldj/archive/2007/04/13/1564072.aspx作者提供的方法,讓筆者實現了更換皮膚的功能。不過該頁面的來源程式始終無法下載,所以筆者開始只能複製上面列出的所有代碼,然後在VS中運行。程式編譯順利通過,不過運行時出現了System.NullReferenceException的錯誤,顯示IrisSkin2對象為空白。於是筆者調試了一下,問題出現在這一句話: se = new Sunisoft.IrisSkin.
Time of Update: 2018-12-05
如果後面的括弧裡帶有形參則為後置單目運算子多載,無形參則為前置單目運算子多載。#include <iostream>using namespace std;//建立時鐘類class Clock{public: Clock(int NewH=0,int NewM=0,int NewS=0);//建構函式 void ShowTime();//顯示時間函式宣告 Clock& operator ++();//前置運算子多載 Clock operator ++(int);//後置運算子
Time of Update: 2018-12-05
尋找字串a是否包含子串b,不是用strA.find(strB) > 0而是strA.find(strB) != string:nposstring::size_type pos = strA.find(strB);if(pos != string::npos){}-------------------------------------------int idx = str.find("abc");if (idx ==
Time of Update: 2018-12-05
在Form_Load和Form_Closing裡調用。using System.Runtime.InteropServices;public class Win32 { public const Int32 AW_HOR_POSITIVE = 0x00000001; // 從左至右開啟視窗 public const Int32 AW_HOR_NEGATIVE = 0x00000002; // 從右至左開啟視窗
Time of Update: 2018-12-05
問題出現在紅色代碼處: int CurProductID = (int)odr["Productid"]; while (CurProductID == (int)odr["Productid"]) { DateTime dt = (DateTime)odr["OrderDate"]; int FieldIndex = SumByMonth? (dt.Month-1) : (dt.Month-1) /
Time of Update: 2018-12-05
轉載:來源:http://www.cnblogs.com/yan0837/articles/304355.html 摘要:本文詳細介紹了MSComm控制項在串口編程中使用。 目 次MSComm控制項兩種處理通訊的方式CommPort屬性RThreshold 屬性CTSHolding 屬性SThreshold 屬性CDHolding 屬性DSRHolding 屬性Settings 屬性InputLen 屬性EOFEnable 屬性Handshake 常數OnComm
Time of Update: 2018-12-05
開發基於.net平台上的程式員是很難從本質上把Visual C#和ActiveX組件聯起來,雖然在使用Visual C#開發應用程式時,有時為了快速開發或者由於.Net Framework SDK的不完整,還需要藉助ActiveX。但即使如此,也很難把二者聯絡起來。其中的原因就是能夠被Visual C#直接使用檔案和通過Visual C#產生的可執行程式只可能是託管的檔案。而Active
Time of Update: 2018-12-05
定位字串 string str="abcd" ; int m1=str.IndexOf("b"); //m1=1 int m2=str.IndexOf("cd"); //m2=2 int m3=str.IndexOf(""); //m3=0 int m4=str.IndexOf("w"); //m4=-1 格式化字串 string str1=String.Format("(C) Currency:{0:C}\n",-123.45678f);
Time of Update: 2018-12-05
FlyTcpFramework源於網上很流行的一個C#非同步TCP通訊類庫,我進行了一些整理和功能上的擴充,加入了檔案傳輸的功能,並製作了一個MSDN風格的手冊。類圖:使用方法:下載源碼並開啟源碼解決方案,解決方案中包含四個項目: FlyTcpFramework:類庫 ppCLient:PDA用戶端Demo PPServer:伺服器端Demo WInClient:WInForm用戶端Demo修改PPserver中監聽的IP地址,運行PPserv
Time of Update: 2018-12-05
字元 說明 樣本 輸出 C貨幣string.Format("{0:C3}", 2)$2.000D十進位string.Format("{0:D3}", 2)002E科學計數法1.20E+0011.20E+001G常規string.Format("{0:G}", 2)2N用分號隔開的數字string.Format("{0:N}", 250000)250,000.00X十六進位string.Format("{0:X000}", 12)Cstring.Format("{0:000.000}", 12.2
Time of Update: 2018-12-05
代碼如下:using System;using System.Reflection;using System.Reflection.Emit ;public class TestReflection {private String file = @"TestReflection.exe";static void Main(String[] args) {TestReflection test = new
Time of Update: 2018-12-05
新開通了部落格,就寫篇文章吧,我們在做項目的過程中不可避免的會碰到需要調用以前別人編寫的程式的問題,可能是.NET編寫的,也可能是c++編寫的。我在做一個Silverlight項目的過程中遇到了這個問題,需要調用c++編寫的dll。
Time of Update: 2018-12-05
View Code using System;using System.Collections;class TempClass{ public class CustomCollection : ICollection { private int[] intArr = { 1, 5, 9 }; private int Ct; public CustomCollection() { Ct = 3;
Time of Update: 2018-12-05
今天又翻開看過的《C#本質論》無意中看到這麼一句:C#中的終結器(也就是解構函式)類似於C++中的析構器,但是由於編譯時間無法確定終結器的執行時機,因此兩者實際上存在相當大的區別。記憶體回收行程調用C#終結器的時機是在對象上一次使用之後,但是在應用程式關閉之前的某個時間。相反,只要一個對象(而非指標)超出範圍,(此處的範圍指範圍),就會自動調用C++析構器。對此我還真有點懷疑,於是分別寫了C++與C#的代碼看一下情況是否真的是這樣。CodeCode highlighting produced
Time of Update: 2018-12-05
廢話少說,看程式就明白了。using System;using System.Collections.Generic;using System.Text;namespace ConsoleApplication1{ /**//// <summary> /// C#轉換操作符號學習 /// </summary> public sealed class MyCls { private string _data; pu
Time of Update: 2018-12-05
System.Diagnostics下面有三個類可以協助我們診斷應用程式:DebugTraceEventLog建立一個VS工程時,VS會為我們定義Trace和Debug這兩個符號,它們的區別是Trace在release版本時也有效,而Debug只在Debug版本中有效。EventLog可以將日誌記錄到Windows的系統日誌中.Trace和Debug這兩個類可以說用著相同的功能,只是Trace更強大些,預設情況下,它們的輸出是調試器的Console。樣本(API的基本使用):class Prog
Time of Update: 2018-12-05
程式碼範例: using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Data.OracleClient;using System.Data;namespace EffectiveCsharp{ interface IMessage { void Message(); } //顯式現實介面樣本 class MyMessa
Time of Update: 2018-12-05
using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace ConsoleApplication1{ class MyCls { public int X { get; set; } public int Y { get;