<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>追風箏的小孩 &#187; 程式</title>
	<atom:link href="http://m955.com/wp/archives/category/%e7%a8%8b%e5%bc%8f/feed" rel="self" type="application/rss+xml" />
	<link>http://m955.com/wp</link>
	<description></description>
	<lastBuildDate>Thu, 03 Nov 2011 14:47:32 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>使用 ZedGraph 製作統計圖</title>
		<link>http://m955.com/wp/archives/237</link>
		<comments>http://m955.com/wp/archives/237#comments</comments>
		<pubDate>Wed, 22 Jul 2009 08:23:30 +0000</pubDate>
		<dc:creator>blue955</dc:creator>
				<category><![CDATA[程式]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[圖表]]></category>

		<guid isPermaLink="false">http://m955.com/wp/archives/237</guid>
		<description><![CDATA[這幾天研究了 ZedGraph，發現它是一套很好用的畫圖表工具，練習做了一個統計圖，大家參考看看！

PLAIN TEXT
C#:




//記得要加入參考


using ZedGraph;


&#160;


//資料來源&#160; &#160; &#160; &#160; 


privat... ]]></description>
			<content:encoded><![CDATA[<p>這幾天研究了 ZedGraph，發現它是一套很好用的畫圖表工具，練習做了一個統計圖，大家參考看看！</p>
<p><a href="http://farm4.static.flickr.com/3529/3744942595_3e8b5a6bcb_o.png" target="_blank" rel="lightbox"><img src="http://farm4.static.flickr.com/3529/3744942595_226b42dbe7.jpg"></a></p>
<div class="igBar"><span id="lcsharp-2"><a href="#" onclick="javascript:showPlainTxt('csharp-2'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">C#:</span>
<div id="csharp-2">
<div class="csharp">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #008080; font-style: italic;">//記得要加入參考</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0600FF;">using</span> ZedGraph;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #008080; font-style: italic;">//資料來源&nbsp; &nbsp; &nbsp; &nbsp; </span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0600FF;">private</span> DataTable getDT<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; DataTable dt = <a href="http://www.google.com/search?q=new+msdn.microsoft.com" target="_blank"><span style="color: #008000;">new</span></a> DataTable<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; dt.<span style="color: #0000FF;">Columns</span>.<span style="color: #0000FF;">Add</span><span style="color: #000000;">&#40;</span><span style="color: #808080;">"學號"</span>, <span style="color: #000000;">System</span>.<span style="color: #0000FF;">Type</span>.<span style="color: #0000FF;">GetType</span><span style="color: #000000;">&#40;</span><span style="color: #808080;">"System.String"</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; dt.<span style="color: #0000FF;">Columns</span>.<span style="color: #0000FF;">Add</span><span style="color: #000000;">&#40;</span><span style="color: #808080;">"姓名"</span>, <span style="color: #000000;">System</span>.<span style="color: #0000FF;">Type</span>.<span style="color: #0000FF;">GetType</span><span style="color: #000000;">&#40;</span><span style="color: #808080;">"System.String"</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; dt.<span style="color: #0000FF;">Columns</span>.<span style="color: #0000FF;">Add</span><span style="color: #000000;">&#40;</span><span style="color: #808080;">"國文"</span>, <span style="color: #000000;">System</span>.<span style="color: #0000FF;">Type</span>.<span style="color: #0000FF;">GetType</span><span style="color: #000000;">&#40;</span><span style="color: #808080;">"System.Int32"</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; dt.<span style="color: #0000FF;">Columns</span>.<span style="color: #0000FF;">Add</span><span style="color: #000000;">&#40;</span><span style="color: #808080;">"英文"</span>, <span style="color: #000000;">System</span>.<span style="color: #0000FF;">Type</span>.<span style="color: #0000FF;">GetType</span><span style="color: #000000;">&#40;</span><span style="color: #808080;">"System.Int32"</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; dt.<span style="color: #0000FF;">Columns</span>.<span style="color: #0000FF;">Add</span><span style="color: #000000;">&#40;</span><span style="color: #808080;">"數學"</span>, <span style="color: #000000;">System</span>.<span style="color: #0000FF;">Type</span>.<span style="color: #0000FF;">GetType</span><span style="color: #000000;">&#40;</span><span style="color: #808080;">"System.Int32"</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; dt.<span style="color: #0000FF;">Rows</span>.<span style="color: #0000FF;">Add</span><span style="color: #000000;">&#40;</span><span style="color: #808080;">"B9510001"</span>, <span style="color: #808080;">"崔昱翰"</span>, <span style="color: #FF0000;color:#800000;">85</span>, <span style="color: #FF0000;color:#800000;">66</span>, <span style="color: #FF0000;color:#800000;">71</span><span style="color: #000000;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; dt.<span style="color: #0000FF;">Rows</span>.<span style="color: #0000FF;">Add</span><span style="color: #000000;">&#40;</span><span style="color: #808080;">"B9510002"</span>, <span style="color: #808080;">"王詩光"</span>, <span style="color: #FF0000;color:#800000;">65</span>, <span style="color: #FF0000;color:#800000;">92</span>, <span style="color: #FF0000;color:#800000;">88</span><span style="color: #000000;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; dt.<span style="color: #0000FF;">Rows</span>.<span style="color: #0000FF;">Add</span><span style="color: #000000;">&#40;</span><span style="color: #808080;">"B9510003"</span>, <span style="color: #808080;">"劉育白"</span>, <span style="color: #FF0000;color:#800000;">52</span>, <span style="color: #FF0000;color:#800000;">66</span>, <span style="color: #FF0000;color:#800000;">63</span><span style="color: #000000;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; dt.<span style="color: #0000FF;">Rows</span>.<span style="color: #0000FF;">Add</span><span style="color: #000000;">&#40;</span><span style="color: #808080;">"B9510004"</span>, <span style="color: #808080;">"許威宇"</span>, <span style="color: #FF0000;color:#800000;">98</span>, <span style="color: #FF0000;color:#800000;">70</span>, <span style="color: #FF0000;color:#800000;">61</span><span style="color: #000000;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; dt.<span style="color: #0000FF;">Rows</span>.<span style="color: #0000FF;">Add</span><span style="color: #000000;">&#40;</span><span style="color: #808080;">"B9510005"</span>, <span style="color: #808080;">"李佩珊"</span>, <span style="color: #FF0000;color:#800000;">81</span>, <span style="color: #FF0000;color:#800000;">63</span>, <span style="color: #FF0000;color:#800000;">76</span><span style="color: #000000;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; dt.<span style="color: #0000FF;">Rows</span>.<span style="color: #0000FF;">Add</span><span style="color: #000000;">&#40;</span><span style="color: #808080;">"B9510006"</span>, <span style="color: #808080;">"潘紹興"</span>, <span style="color: #FF0000;color:#800000;">91</span>, <span style="color: #FF0000;color:#800000;">77</span>, <span style="color: #FF0000;color:#800000;">76</span><span style="color: #000000;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0600FF;">return</span> dt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #008080; font-style: italic;">//學生成績</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0600FF;">public</span> <span style="color: #0600FF;">void</span> StudentChart1<span style="color: #000000;">&#40;</span>ZedGraphControl zgc<span style="color: #000000;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #008080; font-style: italic;">// Google網域搜尋：Fill site:http://zedgraph.sourceforge.net/documentation</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; GraphPane myPane = zgc.<span style="color: #0000FF;">GraphPane</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #008080; font-style: italic;">//</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; DataTable dt = getDT<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #008080; font-style: italic;">// Set the title and axis labels</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; myPane.<span style="color: #0000FF;">Title</span>.<span style="color: #0000FF;">Text</span> = <span style="color: #808080;">"學生成績量化表"</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; myPane.<span style="color: #0000FF;">XAxis</span>.<span style="color: #0000FF;">Title</span>.<span style="color: #0000FF;">Text</span> = <span style="color: #808080;">"學生姓名"</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; myPane.<span style="color: #0000FF;">YAxis</span>.<span style="color: #0000FF;">Title</span>.<span style="color: #0000FF;">Text</span> = <span style="color: #808080;">"分數"</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; PointPairList list1 = <a href="http://www.google.com/search?q=new+msdn.microsoft.com" target="_blank"><span style="color: #008000;">new</span></a> PointPairList<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; PointPairList list2 = <a href="http://www.google.com/search?q=new+msdn.microsoft.com" target="_blank"><span style="color: #008000;">new</span></a> PointPairList<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; PointPairList list3 = <a href="http://www.google.com/search?q=new+msdn.microsoft.com" target="_blank"><span style="color: #008000;">new</span></a> PointPairList<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; Random rand = <a href="http://www.google.com/search?q=new+msdn.microsoft.com" target="_blank"><span style="color: #008000;">new</span></a> Random<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #008080; font-style: italic;">// Generate random data for three curves</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0600FF;">for</span> <span style="color: #000000;">&#40;</span><span style="color: #FF0000;">int</span> i = <span style="color: #FF0000;color:#800000;">0</span>; i &lt;dt.<span style="color: #0000FF;">Rows</span>.<span style="color: #0000FF;">Count</span>; i++<span style="color: #000000;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #000000;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #FF0000;">double</span> x = <span style="color: #000000;">&#40;</span><span style="color: #FF0000;">double</span><span style="color: #000000;">&#41;</span>i;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #FF0000;">double</span> y1_chian = Convert.<span style="color: #0000FF;">ToDouble</span><span style="color: #000000;">&#40;</span>dt.<span style="color: #0000FF;">Rows</span><span style="color: #000000;">&#91;</span>i<span style="color: #000000;">&#93;</span><span style="color: #000000;">&#91;</span><span style="color: #808080;">"國文"</span><span style="color: #000000;">&#93;</span><span style="color: #000000;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #FF0000;">double</span> y2_eng = Convert.<span style="color: #0000FF;">ToDouble</span><span style="color: #000000;">&#40;</span>dt.<span style="color: #0000FF;">Rows</span><span style="color: #000000;">&#91;</span>i<span style="color: #000000;">&#93;</span><span style="color: #000000;">&#91;</span><span style="color: #808080;">"英文"</span><span style="color: #000000;">&#93;</span><span style="color: #000000;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #FF0000;">double</span> y3_math = Convert.<span style="color: #0000FF;">ToDouble</span><span style="color: #000000;">&#40;</span>dt.<span style="color: #0000FF;">Rows</span><span style="color: #000000;">&#91;</span>i<span style="color: #000000;">&#93;</span><span style="color: #000000;">&#91;</span><span style="color: #808080;">"數學"</span><span style="color: #000000;">&#93;</span><span style="color: #000000;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; list1.<span style="color: #0000FF;">Add</span><span style="color: #000000;">&#40;</span>x, y1_chian<span style="color: #000000;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; list2.<span style="color: #0000FF;">Add</span><span style="color: #000000;">&#40;</span>x, y2_eng<span style="color: #000000;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; list3.<span style="color: #0000FF;">Add</span><span style="color: #000000;">&#40;</span>x, y3_math<span style="color: #000000;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #000000;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #008080; font-style: italic;">// create the curves</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #008080; font-style: italic;">// BarItem.Bar.Fill(Color) 填入單一顏色</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #008080; font-style: italic;">// BarItem.Bar.Fill(Color, Color, Color, 90) 填入漸層顏色，第4參數是旋轉角度</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; BarItem myCurve1 = myPane.<span style="color: #0000FF;">AddBar</span><span style="color: #000000;">&#40;</span><span style="color: #808080;">"國文"</span>, list1, Color.<span style="color: #0000FF;">Red</span><span style="color: #000000;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; myCurve1.<span style="color: #0000FF;">Bar</span>.<span style="color: #0000FF;">Fill</span> = <a href="http://www.google.com/search?q=new+msdn.microsoft.com" target="_blank"><span style="color: #008000;">new</span></a> Fill<span style="color: #000000;">&#40;</span>Color.<span style="color: #0000FF;">FromArgb</span><span style="color: #000000;">&#40;</span><span style="color: #FF0000;color:#800000;">255</span>, <span style="color: #FF0000;color:#800000;">238</span>, <span style="color: #FF0000;color:#800000;">221</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; </div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; BarItem myCurve2 = myPane.<span style="color: #0000FF;">AddBar</span><span style="color: #000000;">&#40;</span><span style="color: #808080;">"英文"</span>, list2, Color.<span style="color: #0000FF;">Blue</span><span style="color: #000000;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; myCurve2.<span style="color: #0000FF;">Bar</span>.<span style="color: #0000FF;">Fill</span> = <a href="http://www.google.com/search?q=new+msdn.microsoft.com" target="_blank"><span style="color: #008000;">new</span></a> Fill<span style="color: #000000;">&#40;</span>Color.<span style="color: #0000FF;">FromArgb</span><span style="color: #000000;">&#40;</span><span style="color: #FF0000;color:#800000;">221</span>, <span style="color: #FF0000;color:#800000;">255</span>, <span style="color: #FF0000;color:#800000;">238</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; BarItem myCurve3 = myPane.<span style="color: #0000FF;">AddBar</span><span style="color: #000000;">&#40;</span><span style="color: #808080;">"數學"</span>, list3, Color.<span style="color: #0000FF;">Green</span><span style="color: #000000;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; myCurve3.<span style="color: #0000FF;">Bar</span>.<span style="color: #0000FF;">Fill</span> = <a href="http://www.google.com/search?q=new+msdn.microsoft.com" target="_blank"><span style="color: #008000;">new</span></a> Fill<span style="color: #000000;">&#40;</span>Color.<span style="color: #0000FF;">FromArgb</span><span style="color: #000000;">&#40;</span><span style="color: #FF0000;color:#800000;">238</span>, <span style="color: #FF0000;color:#800000;">221</span>, <span style="color: #FF0000;color:#800000;">255</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; </div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #008080; font-style: italic;">// Fill the axis background with a color gradient</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #008080; font-style: italic;">// 背景色</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #008080; font-style: italic;">// myPane.Chart.Fill = new Fill(Color.White, Color.FromArgb(255, 255, 166), 45.0F);</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; myPane.<span style="color: #0000FF;">XAxis</span>.<span style="color: #0000FF;">MajorTic</span>.<span style="color: #0000FF;">IsBetweenLabels</span> = <span style="color: #0600FF;">true</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #008080; font-style: italic;">//加入X LabelText</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #FF0000;">string</span><span style="color: #000000;">&#91;</span><span style="color: #000000;">&#93;</span> labels = <a href="http://www.google.com/search?q=new+msdn.microsoft.com" target="_blank"><span style="color: #008000;">new</span></a> <span style="color: #FF0000;">string</span><span style="color: #000000;">&#91;</span><span style="color: #FF0000;color:#800000;">6</span><span style="color: #000000;">&#93;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0600FF;">for</span> <span style="color: #000000;">&#40;</span><span style="color: #FF0000;">int</span> i = <span style="color: #FF0000;color:#800000;">0</span>; i &lt;dt.<span style="color: #0000FF;">Rows</span>.<span style="color: #0000FF;">Count</span>; i++<span style="color: #000000;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #000000;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; labels<span style="color: #000000;">&#91;</span>i<span style="color: #000000;">&#93;</span> = Convert.<span style="color: #0000FF;">ToString</span><span style="color: #000000;">&#40;</span>dt.<span style="color: #0000FF;">Rows</span><span style="color: #000000;">&#91;</span>i<span style="color: #000000;">&#93;</span><span style="color: #000000;">&#91;</span><span style="color: #808080;">"姓名"</span><span style="color: #000000;">&#93;</span><span style="color: #000000;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #000000;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; myPane.<span style="color: #0000FF;">XAxis</span>.<span style="color: #0000FF;">Scale</span>.<span style="color: #0000FF;">TextLabels</span> = labels; <span style="color: #008080; font-style: italic;">//X軸的說明文字</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; myPane.<span style="color: #0000FF;">XAxis</span>.<span style="color: #0000FF;">Type</span> = AxisType.<span style="color: #0000FF;">Text</span>;&nbsp; &nbsp; &nbsp; <span style="color: #008080; font-style: italic;">//X軸類型</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #008080; font-style: italic;">//重新計算目前數據範圍</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; zgc.<span style="color: #0000FF;">AxisChange</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #008080; font-style: italic;">// expand the range of the Y axis slightly to accommodate the labels</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #008080; font-style: italic;">// myPane.YAxis.Scale.Max += myPane.YAxis.Scale.MajorStep;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #008080; font-style: italic;">// YAxis最大值</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; myPane.<span style="color: #0000FF;">YAxis</span>.<span style="color: #0000FF;">Scale</span>.<span style="color: #0000FF;">Max</span> = <span style="color: #FF0000;color:#800000;">110</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #008080; font-style: italic;">// Create TextObj's to provide labels for each bar</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #008080; font-style: italic;">// 在bar上顯示數值</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; BarItem.<span style="color: #0000FF;">CreateBarLabels</span><span style="color: #000000;">&#40;</span>myPane, <span style="color: #0600FF;">false</span>, <span style="color: #808080;">"f0"</span><span style="color: #000000;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #008080; font-style: italic;">//顯示格點</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; myPane.<span style="color: #0000FF;">YAxis</span>.<span style="color: #0000FF;">MajorGrid</span>.<span style="color: #0000FF;">IsVisible</span> = <span style="color: #0600FF;">true</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; myPane.<span style="color: #0000FF;">XAxis</span>.<span style="color: #0000FF;">MajorGrid</span>.<span style="color: #0000FF;">IsVisible</span> = <span style="color: #0600FF;">true</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
]]></content:encoded>
			<wfw:commentRss>http://m955.com/wp/archives/237/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>.Net 第三方繪圖控件 dotnetCharting 和 ZedGraph 比較，</title>
		<link>http://m955.com/wp/archives/235</link>
		<comments>http://m955.com/wp/archives/235#comments</comments>
		<pubDate>Tue, 21 Jul 2009 09:10:50 +0000</pubDate>
		<dc:creator>blue955</dc:creator>
				<category><![CDATA[程式]]></category>
		<category><![CDATA[圖表]]></category>

		<guid isPermaLink="false">http://m955.com/wp/archives/235</guid>
		<description><![CDATA[&#160;&#160;&#160;&#160;&#160;&#160;&#160; 最近參考了幾個統計圖表控件包，OpenSource 的有 ZedGraph，Nplot 等，但是相比之下還是 ZedGraph 強大，方便一些，其他的感覺還是半成品。

&#160;&#160;&#160;&#160;&#160;&#... ]]></description>
			<content:encoded><![CDATA[<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 最近參考了幾個統計圖表控件包，OpenSource 的有 <a href="http://zedgraph.org/" target="_blank">ZedGraph</a>，<a href="http://netcontrols.org/nplot/" target="_blank">Nplot</a> 等，但是相比之下還是 ZedGraph 強大，方便一些，其他的感覺還是半成品。
<p><img src="http://farm3.static.flickr.com/2630/3742414956_6a73bc31b8_o.png">
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 收費的套件就多了，只要是商業的報表開發工具都有統計圖表的功能，水晶報表，ActiveReport，Reporting Service，不過要方便，功能單一的還是 <a href="http://www.dotnetcharting.com/" target="_blank">dotnetCharting</a>。下面主要從 winform 使用上說說 ZedGraph 和 dotnetCharting。
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 從效果上說 dotnetCharting 確實沒的說，水晶式效果很是炫目，這應該是其最大的賣點。為了便於開發者學習，帶了各種效果的示例代碼。DotnetCharting 在產生統計圖的時候需要設置一個臨時目錄，用來保存產生的統計圖的圖片，dotnetCharting 的圖表效果好，很大程度上是因為它生成了圖片，然後將其顯示在界面上。當然，作為代價，它犧牲了性能。同時，它不支持縮放，雖然你可以通過更改坐標軸的刻度來實現這個功能，但是性能上就差了很多。
<p>如果你對性能要求不高，<a href="http://www.dotnetcharting.com/" target="_blank">dotnetCharting</a> 是非常好的選擇。
<p><img src="http://farm3.static.flickr.com/2601/3742415058_e51fc0c355.jpg">
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ZedGraph 最大的賣點在哪裡？應該是OpenSource，你可以修改代碼以適應自己的需求，例如：ZedGraph 在畫線型圖的時候，線條沒有使用抗鋸齒，你只要修改 Line類的 Default 結構中的預設設置就可以了。和 dotnetCharting 相比，ZedGraph 的效果要差一些，不過，要是自己調整的好，也還不錯，但是 ZedGraph 的優勢不在這裡。
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 由於 ZedGraph 是使用 GDI+ 直接在 Canvas 上進行描畫，所以，性能得到了保證，如果你改變坐標軸的刻度，和 dotnetCharing 相比，ZedGraph 的反應速度是很快的。基於此，ZedGraph 提供了很重要的縮放和拖動功能，你可以通過鼠標滾輪進行方法，縮小圖表，可以通過鼠標中鍵來拖動，非常方便。
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 對於類似股市的實時走勢，CPU 使用率等實時變化的數據，使用 ZedGraph 也可以很方便地作到。ZedGraph 在基於 PointPairList 作畫，所以你只要在 PointPairList 這個集合中添加新的數據，然後進行重畫就可以實現了，對於性能，上面說了，由於是直接使用 GDI+，性能是比較好的，我測過 400 個點是沒問題的。所以，ZedGraph 對於實時要求比較強的需求也是可以應對的。
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 總結的來說，dotnetCHARTING 產出的圖表效果好，但是性能方面較差，對實時要求強的需求不適應。ZedGraph 開放原始碼，效果比起 dotnetCHARTING 差，但是性能好，能適應有實時要求的數據。
<p>本文章轉貼於：<a title="http://blog.csai.cn/user1/17072/archives/2009/37706.html" href="http://blog.csai.cn/user1/17072/archives/2009/37706.html" target="_blank">http://blog.csai.cn/user1/17072/archives/2009/37706.html</a></p>
]]></content:encoded>
			<wfw:commentRss>http://m955.com/wp/archives/235/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>連結資料庫四大步驟（以 ASP.NET 為例）</title>
		<link>http://m955.com/wp/archives/219</link>
		<comments>http://m955.com/wp/archives/219#comments</comments>
		<pubDate>Mon, 22 Jun 2009 13:54:33 +0000</pubDate>
		<dc:creator>blue955</dc:creator>
				<category><![CDATA[程式]]></category>
		<category><![CDATA[ADO.NET]]></category>
		<category><![CDATA[C#]]></category>

		<guid isPermaLink="false">http://m955.com/wp/?p=219</guid>
		<description><![CDATA[其實 WinForm 跟 WebForm 在連結資料庫方面其實差不了太多。
PLAIN TEXT
C#:




protected void Page_Load&#40;object sender, EventArgs e&#41;


&#123;


&#160; &#160; //第一：連結SQL資料庫


&#160; &#160; string connstr = @"Data Sou... ]]></description>
			<content:encoded><![CDATA[<p>其實 WinForm 跟 WebForm 在連結資料庫方面其實差不了太多。</p>
<div class="igBar"><span id="lcsharp-4"><a href="#" onclick="javascript:showPlainTxt('csharp-4'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">C#:</span>
<div id="csharp-4">
<div class="csharp">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0600FF;">protected</span> <span style="color: #0600FF;">void</span> Page_Load<span style="color: #000000;">&#40;</span><span style="color: #FF0000;">object</span> sender, EventArgs e<span style="color: #000000;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #008080; font-style: italic;">//第一：連結SQL資料庫</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #FF0000;">string</span> connstr = <span style="color: #808080;">@"Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\test_Data.MDF;Integrated Security=True;Connect Timeout=30;User Instance=True"</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; SqlConnection conn = <a href="http://www.google.com/search?q=new+msdn.microsoft.com" target="_blank"><span style="color: #008000;">new</span></a> SqlConnection<span style="color: #000000;">&#40;</span>connstr<span style="color: #000000;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; conn.<span style="color: #0000FF;">Open</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #008080; font-style: italic;">//第二：執行SQL指令</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #FF0000;">string</span> sqlstr = <span style="color: #808080;">"select * from test"</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; SqlCommand cmd = <a href="http://www.google.com/search?q=new+msdn.microsoft.com" target="_blank"><span style="color: #008000;">new</span></a> SqlCommand<span style="color: #000000;">&#40;</span>sqlstr,conn<span style="color: #000000;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; SqlDataReader dr = cmd.<span style="color: #0000FF;">ExecuteReader</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #008080; font-style: italic;">//第三：印出資料</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0600FF;">while</span> <span style="color: #000000;">&#40;</span>dr.<span style="color: #0000FF;">Read</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #000000;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; Response.<span style="color: #0000FF;">Write</span><span style="color: #000000;">&#40;</span><span style="color: #808080;">"文章編號："</span> + dr<span style="color: #000000;">&#91;</span><span style="color: #808080;">"id"</span><span style="color: #000000;">&#93;</span> + <span style="color: #808080;">"&lt;br&gt;"</span><span style="color: #000000;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; Response.<span style="color: #0000FF;">Write</span><span style="color: #000000;">&#40;</span><span style="color: #808080;">"日　　期："</span> + dr<span style="color: #000000;">&#91;</span><span style="color: #808080;">"test_time"</span><span style="color: #000000;">&#93;</span> + <span style="color: #808080;">"&lt;br&gt;"</span><span style="color: #000000;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; Response.<span style="color: #0000FF;">Write</span><span style="color: #000000;">&#40;</span><span style="color: #808080;">"文章標題："</span> + dr<span style="color: #000000;">&#91;</span><span style="color: #808080;">"title"</span><span style="color: #000000;">&#93;</span><span style="color: #000000;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; Response.<span style="color: #0000FF;">Write</span><span style="color: #000000;">&#40;</span><span style="color: #808080;">"&lt;hr&gt;"</span><span style="color: #000000;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #000000;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #008080; font-style: italic;">//第四：關閉連線</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; cmd.<span style="color: #0000FF;">Cancel</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; dr.<span style="color: #0000FF;">Close</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; conn.<span style="color: #0000FF;">Close</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; conn.<span style="color: #0000FF;">Dispose</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>文章參考於：<a href="http://findbook.tw/book/9789862042380/basic" target="_blank">ASP.NET專題實務-適用C# 作者：周棟祥</a></p>
]]></content:encoded>
			<wfw:commentRss>http://m955.com/wp/archives/219/feed</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>驗證 ASP.NET Web 網頁中的使用者輸入</title>
		<link>http://m955.com/wp/archives/210</link>
		<comments>http://m955.com/wp/archives/210#comments</comments>
		<pubDate>Sun, 21 Jun 2009 16:04:58 +0000</pubDate>
		<dc:creator>blue955</dc:creator>
				<category><![CDATA[程式]]></category>
		<category><![CDATA[ADO.NET]]></category>
		<category><![CDATA[C#]]></category>

		<guid isPermaLink="false">http://m955.com/wp/?p=210</guid>
		<description><![CDATA[工具：RequiredFieldValidator
驗證：必要輸入項
說明：確保使用者不會略過輸入項目。如需詳細資訊，請參閱 HOW TO：驗證 ASP.NET 伺服器控制項的必要項目。
工具：CompareValidator
驗證：與某個值的比... ]]></description>
			<content:encoded><![CDATA[<p>工具：<a href="http://msdn.microsoft.com/zh-tw/library/system.web.ui.webcontrols.requiredfieldvalidator.aspx" target="_blank">RequiredFieldValidator</a><br />
驗證：必要輸入項<br />
說明：確保使用者不會略過輸入項目。<a href="http://msdn.microsoft.com/zh-tw/library/e78xxk8k.aspx" target="_blank">如需詳細資訊，請參閱 HOW TO：驗證 ASP.NET 伺服器控制項的必要項目。</a></p>
<p>工具：<a href="http://msdn.microsoft.com/zh-tw/library/system.web.ui.webcontrols.comparevalidator.aspx" target="_blank">CompareValidator</a><br />
驗證：與某個值的比較<br />
說明：使用比較運算子 (例如小於、等於、大於)，將使用者輸入的值與常數值、另一個控制項的值，或特定資料型別做比較。<a href="http://msdn.microsoft.com/zh-tw/library/ad548tzy.aspx" target="_blank">如需詳細資訊，請參閱 HOW TO：比對特定值驗證 ASP.NET 伺服器控制項和 HOW TO：比對資料型別驗證 ASP.NET 伺服器控制項。</a></p>
<p>工具：<a href="http://msdn.microsoft.com/zh-tw/library/system.web.ui.webcontrols.rangevalidator.aspx" target="_blank">RangeValidator</a><br />
驗證：範圍檢查<br />
說明：檢查使用者的輸入是否介於指定的上下限之間。您可以檢查成對的數字、英文字母字元和日期內的範圍。如需詳細資訊，<a href="http://msdn.microsoft.com/zh-tw/library/bk58fdzx.aspx" target="_blank">請參閱 HOW TO：比對範圍值驗證 ASP.NET 伺服器控制項。</a></p>
<p>工具：<a href="http://msdn.microsoft.com/zh-tw/library/system.web.ui.webcontrols.regularexpressionvalidator.aspx" target="_blank">RegularExpressionValidator</a><br />
驗證：樣式比對<br />
說明：檢查輸入是否符合規則運算式 (Regular Expression) 所定義的樣式。這類的驗證可讓您檢查字元 (例如電子郵件地址、電話號碼、郵遞區號等項目中的字元) 的預期順序。<a href="http://msdn.microsoft.com/zh-tw/library/6xh899wy.aspx" target="_blank">如需詳細資訊，請參閱 HOW TO：比對模式驗證 ASP.NET 伺服器控制項。</a></p>
<p>工具：<a href="http://msdn.microsoft.com/zh-tw/library/system.web.ui.webcontrols.customvalidator.aspx" target="_blank">CustomValidator</a><br />
驗證：使用者定義<br />
說明：使用您自己撰寫的邏輯驗證使用者的輸入。這類驗證可讓您檢查執行階段時衍生的值。如需詳細資訊，<a href="http://msdn.microsoft.com/zh-tw/library/f5db6z8k.aspx" target="_blank">請參閱 HOW TO：使用 ASP.NET 伺服器控制項的自訂函式驗證</a>和 <a href="http://msdn.microsoft.com/zh-tw/library/s5z00s5e.aspx" target="_blank">HOW TO：比對資料庫值驗證 ASP.NET 伺服器控制項。</a></p>
<p><a href="http://msdn.microsoft.com/zh-tw/library/bwd43d0x.aspx" target="_blank"><br />
MSDN</a></p>
]]></content:encoded>
			<wfw:commentRss>http://m955.com/wp/archives/210/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>在 VS2005 工具列中增加 AJAX 擴充功能</title>
		<link>http://m955.com/wp/archives/203</link>
		<comments>http://m955.com/wp/archives/203#comments</comments>
		<pubDate>Sat, 20 Jun 2009 17:17:20 +0000</pubDate>
		<dc:creator>blue955</dc:creator>
				<category><![CDATA[程式]]></category>
		<category><![CDATA[AJAX]]></category>
		<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[C#]]></category>

		<guid isPermaLink="false">http://m955.com/wp/?p=203</guid>
		<description><![CDATA[
　　在 VS20085 工具列中，AJAX 擴充功能這個選項是內建的，不過在 VS2005 中並沒有，現在坊間的書籍大多以 VS2008 為主，會常用到 AJAX 功能，不過如果不更換版本，在 VS2005 中也可以安裝 AJAX 擴... ]]></description>
			<content:encoded><![CDATA[<p><img alt="" src="http://farm3.static.flickr.com/2244/3644497936_c8bb9ba096_o.png" class="alignnone" width="165" height="138" /></p>
<p>　　在 VS20085 工具列中，AJAX 擴充功能這個選項是內建的，不過在 VS2005 中並沒有，現在坊間的書籍大多以 VS2008 為主，會常用到 AJAX 功能，不過如果不更換版本，在 VS2005 中也可以安裝 AJAX 擴充功能。你必須下載以下檔案（約1MB多）安裝完成後，AJAX 擴充功能就會出現了。</p>
<p>下載檔案：<a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=ca9d90fa-e8c9-42e3-aa19-08e2c027f5d6&#038;displaylang=en" target="_blank"><br />
ASP.NET AJAX 1.0</a></p>
]]></content:encoded>
			<wfw:commentRss>http://m955.com/wp/archives/203/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>[寫程式] 藝術？還是快速開發？</title>
		<link>http://m955.com/wp/archives/201</link>
		<comments>http://m955.com/wp/archives/201#comments</comments>
		<pubDate>Sat, 20 Jun 2009 09:19:22 +0000</pubDate>
		<dc:creator>blue955</dc:creator>
				<category><![CDATA[程式]]></category>
		<category><![CDATA[C#]]></category>

		<guid isPermaLink="false">http://m955.com/wp/?p=201</guid>
		<description><![CDATA[　　用 Visual Studio 久了會發現一個問題，就是會越來越依賴這個開發工具，因為它什麼都幫你處理好了，程式指令永遠只記得前面三個字母，因為VS有指令自動補齊，連接資料庫有精靈幫忙，管... ]]></description>
			<content:encoded><![CDATA[<p>　　用 Visual Studio 久了會發現一個問題，就是會越來越依賴這個開發工具，因為它什麼都幫你處理好了，程式指令永遠只記得前面三個字母，因為VS有指令自動補齊，連接資料庫有精靈幫忙，管你是 MSSQL 還是 Access，全部按一按搞定，還順便幫你把 Insert、Update、Select、Delete…等 SQL 四大溝通指令寫好了，程式就這麼在拖拉、設定之間開發完成，有的甚至不用寫任何一行指令。</p>
<p>　　以前我很排斥用精靈方式來寫程式，堅持一字一句 Key 出來，不過我發現這會花費很多時間，舉個例子來說好了，寫一個簡單的通訊錄，不包括建資料庫的時間，用傳統手 Key 方式，我大概要花上半天的時間，因為我要拉控制項、設定控制項名稱、寫資料庫連接、資料繫結、資料配接器的 Insert、Update、Select、Delete 四個屬性質、設定 BindSource 導覽列…等，寫完天都黑了。</p>
<p>　　不過如果換成精靈模式寫，大概只要30分鐘就可以搞定，在產出力方面，精靈模式大勝，不過在程式靈活度、和可讀性來說，還是傳統手 Key 方式略勝一籌。</p>
<p>　　站在公司的立場，當然希望程式設計師的產出力越多越好，有些小地方還是用拖拉的就好，藝術這種東西不能當飯吃，VS是一個很邪惡的東西，因為他讓新手認為寫程式是一件很簡單的東西，讓老手離不開它。</p>
]]></content:encoded>
			<wfw:commentRss>http://m955.com/wp/archives/201/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>C# string.Format輸出格式</title>
		<link>http://m955.com/wp/archives/176</link>
		<comments>http://m955.com/wp/archives/176#comments</comments>
		<pubDate>Fri, 19 Jun 2009 03:46:49 +0000</pubDate>
		<dc:creator>blue955</dc:creator>
				<category><![CDATA[程式]]></category>
		<category><![CDATA[C#]]></category>

		<guid isPermaLink="false">http://m955.com/wp/?p=176</guid>
		<description><![CDATA[PLAIN TEXT
C#:




前面補0的數字字串


String.Format&#40;"{0:0000}", 157&#41;; // 輸出 0157


&#160;


前後都補0的數字字串


String.Format&#40;"{0:0000.0000}", 157.42&#41;; // 輸出 0157.4200


&#160;


每3位數&#40;千&#41;加逗... ]]></description>
			<content:encoded><![CDATA[<div class="igBar"><span id="lcsharp-7"><a href="#" onclick="javascript:showPlainTxt('csharp-7'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">C#:</span>
<div id="csharp-7">
<div class="csharp">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">前面補<span style="color: #FF0000;color:#800000;">0</span>的數字字串</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #FF0000;">String</span>.<span style="color: #0000FF;">Format</span><span style="color: #000000;">&#40;</span><span style="color: #808080;">"{0:0000}"</span>, <span style="color: #FF0000;color:#800000;">157</span><span style="color: #000000;">&#41;</span>; <span style="color: #008080; font-style: italic;">// 輸出 0157</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">前後都補<span style="color: #FF0000;color:#800000;">0</span>的數字字串</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #FF0000;">String</span>.<span style="color: #0000FF;">Format</span><span style="color: #000000;">&#40;</span><span style="color: #808080;">"{0:0000.0000}"</span>, <span style="color: #FF0000;color:#800000;">157</span>.<span style="color: #FF0000;color:#800000;">42</span><span style="color: #000000;">&#41;</span>; <span style="color: #008080; font-style: italic;">// 輸出 0157.4200</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">每<span style="color: #FF0000;color:#800000;">3</span>位數<span style="color: #000000;">&#40;</span>千<span style="color: #000000;">&#41;</span>加逗號</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000;">&#40;</span><span style="color: #FF0000;">String</span>.<span style="color: #0000FF;">Format</span><span style="color: #000000;">&#40;</span><span style="color: #808080;">"{0:0,0}"</span>, <span style="color: #FF0000;color:#800000;">38560</span><span style="color: #000000;">&#41;</span>; <span style="color: #008080; font-style: italic;">// 輸出 38,560</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">格式化電話號碼</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000;">&#40;</span><span style="color: #FF0000;">String</span>.<span style="color: #0000FF;">Format</span><span style="color: #000000;">&#40;</span><span style="color: #808080;">"{0:(###) ###-####}"</span>, <span style="color: #FF0000;color:#800000;">8005551212</span><span style="color: #000000;">&#41;</span>; <span style="color: #008080; font-style: italic;">// 輸出 (800) 555-1212</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">金額的表示</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000;">&#40;</span><span style="color: #FF0000;">String</span>.<span style="color: #0000FF;">Format</span><span style="color: #000000;">&#40;</span><span style="color: #808080;">"{0:$#,##0.00;($#,##0.00);Zero}"</span>, <span style="color: #FF0000;color:#800000;">0</span><span style="color: #000000;">&#41;</span>; <span style="color: #008080; font-style: italic;">// 這個會顯示 Zero</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000;">&#40;</span><span style="color: #FF0000;">String</span>.<span style="color: #0000FF;">Format</span><span style="color: #000000;">&#40;</span><span style="color: #808080;">"{0:$#,##0.00;($#,##0.00);Zero}"</span>, <span style="color: #FF0000;color:#800000;">1243</span>.<span style="color: #FF0000;color:#800000;">50</span><span style="color: #000000;">&#41;</span>; <span style="color: #008080; font-style: italic;">// 這個會顯示 $1,243.50 </span></div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>依照上面格式範例 ~ 套用到我的報表要呈現的欄位 ~ 如以下 ~</p>
<div class="igBar"><span id="lcsharp-8"><a href="#" onclick="javascript:showPlainTxt('csharp-8'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">C#:</span>
<div id="csharp-8">
<div class="csharp">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0600FF;">private</span> <span style="color: #0600FF;">void</span> DataGrid_ItemDataBound<span style="color: #000000;">&#40;</span><span style="color: #FF0000;">object</span> sender, <span style="color: #000000;">System</span>.<span style="color: #0000FF;">Web</span>.<span style="color: #0000FF;">UI</span>.<span style="color: #0000FF;">WebControls</span>.<span style="color: #0000FF;">DataGridItemEventArgs</span> e<span style="color: #000000;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #000000;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;<span style="color: #0600FF;">if</span> <span style="color: #000000;">&#40;</span>e.<span style="color: #0000FF;">Item</span>.<span style="color: #0000FF;">ItemIndex</span>.<span style="color: #0000FF;">ToString</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> != <span style="color: #808080;">"-1"</span><span style="color: #000000;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;<span style="color: #000000;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; e.<span style="color: #0000FF;">Item</span>.<span style="color: #0000FF;">Cells</span><span style="color: #000000;">&#91;</span><span style="color: #FF0000;color:#800000;">0</span><span style="color: #000000;">&#93;</span>.<span style="color: #0000FF;">Text</span> = <span style="color: #FF0000;">string</span>.<span style="color: #0000FF;">Format</span><span style="color: #000000;">&#40;</span><span style="color: #808080;">"{0:#,0.0}"</span>,<span style="color: #FF0000;">double</span>.<span style="color: #0000FF;">Parse</span><span style="color: #000000;">&#40;</span>e.<span style="color: #0000FF;">Item</span>.<span style="color: #0000FF;">Cells</span><span style="color: #000000;">&#91;</span><span style="color: #FF0000;color:#800000;">3</span><span style="color: #000000;">&#93;</span>.<span style="color: #0000FF;">Text</span>.<span style="color: #0000FF;">ToString</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;<span style="color: #000000;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #000000;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>參考資料來源：<br />
http://blog.stevex.net/index.php/string-formatting-in-csharp/</p>
]]></content:encoded>
			<wfw:commentRss>http://m955.com/wp/archives/176/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>ASP.NET 出現訊息「伺服器應用程式無法使用」解決方法</title>
		<link>http://m955.com/wp/archives/190</link>
		<comments>http://m955.com/wp/archives/190#comments</comments>
		<pubDate>Thu, 18 Jun 2009 15:14:10 +0000</pubDate>
		<dc:creator>blue955</dc:creator>
				<category><![CDATA[程式]]></category>
		<category><![CDATA[ASP.NET]]></category>

		<guid isPermaLink="false">http://m955.com/wp/?p=190</guid>
		<description><![CDATA[伺服器應用程式無法使用
您嘗試在此 Web 伺服器上存取的 Web 應用程式目前無法使用。
請按 Web 瀏覽器中的 [重新整理] 按鈕，再試一次。
系統管理員注意:
Web 伺服器的應用程式事件記錄檔中的
... ]]></description>
			<content:encoded><![CDATA[<p>伺服器應用程式無法使用<br />
您嘗試在此 Web 伺服器上存取的 Web 應用程式目前無法使用。<br />
請按 Web 瀏覽器中的 [重新整理] 按鈕，再試一次。</p>
<p>系統管理員注意:<br />
Web 伺服器的應用程式事件記錄檔中的<br />
錯誤訊息詳細說明了這項特定要求失敗原因。<br />
請檢閱這個記錄項目，查看造成錯誤的原因為何。</p>
<p>終於找到<br />
方法解決了~"~</p>
<p>http://blog.xuite.net/giin/blog/13640747</p>
<p>請直接到<br />
[開始]→[執行]→輸入<br />
[　C:\WINDOWS\Microsoft.Net\Framework\v2.0.50727\aspnet_regiis.exe -i　] 就行了</p>
<p>最後確認一下預設的IIS執行環境</p>
<p>IIS→預設網站→內容→ASP.NET→確認　版本2.0.50727</p>
<p>應該就OK了!! </p>
]]></content:encoded>
			<wfw:commentRss>http://m955.com/wp/archives/190/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>C# 如何取得兩個 DateTime 日期之間相差的天數</title>
		<link>http://m955.com/wp/archives/186</link>
		<comments>http://m955.com/wp/archives/186#comments</comments>
		<pubDate>Wed, 04 Feb 2009 14:09:48 +0000</pubDate>
		<dc:creator>blue955</dc:creator>
				<category><![CDATA[程式]]></category>
		<category><![CDATA[C#]]></category>

		<guid isPermaLink="false">http://m955.com/wp/?p=186</guid>
		<description><![CDATA[PLAIN TEXT
C#:




DateTime dt1 = new DateTime&#40;2008, 12, 31&#41;;


DateTime dt2 = new DateTime&#40;2009, 2, 13&#41;;


TimeSpan s = new TimeSpan&#40;dt2.Ticks - dt1.Ticks&#41;;


MessageBox.Show&#40;Convert.ToString&#40;s.Days&#41;&#41;;


&#160;


... ]]></description>
			<content:encoded><![CDATA[<div class="igBar"><span id="lcsharp-10"><a href="#" onclick="javascript:showPlainTxt('csharp-10'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">C#:</span>
<div id="csharp-10">
<div class="csharp">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">DateTime dt1 = <a href="http://www.google.com/search?q=new+msdn.microsoft.com" target="_blank"><span style="color: #008000;">new</span></a> DateTime<span style="color: #000000;">&#40;</span><span style="color: #FF0000;color:#800000;">2008</span>, <span style="color: #FF0000;color:#800000;">12</span>, <span style="color: #FF0000;color:#800000;">31</span><span style="color: #000000;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">DateTime dt2 = <a href="http://www.google.com/search?q=new+msdn.microsoft.com" target="_blank"><span style="color: #008000;">new</span></a> DateTime<span style="color: #000000;">&#40;</span><span style="color: #FF0000;color:#800000;">2009</span>, <span style="color: #FF0000;color:#800000;">2</span>, <span style="color: #FF0000;color:#800000;">13</span><span style="color: #000000;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">TimeSpan s = <a href="http://www.google.com/search?q=new+msdn.microsoft.com" target="_blank"><span style="color: #008000;">new</span></a> TimeSpan<span style="color: #000000;">&#40;</span>dt2.<span style="color: #0000FF;">Ticks</span> - dt1.<span style="color: #0000FF;">Ticks</span><span style="color: #000000;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">MessageBox.<span style="color: #0000FF;">Show</span><span style="color: #000000;">&#40;</span>Convert.<span style="color: #0000FF;">ToString</span><span style="color: #000000;">&#40;</span>s.<span style="color: #0000FF;">Days</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #008080; font-style: italic;">//回傳44天，相反則為負值 </span></div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>　</p>
<p>參考網址：<br />
<a href="http://blog.miniasp.com/post/2008/01/Find-the-difference-between-two-DateTime.aspx" target="_blank">C# 如何取得兩個 DateTime 日期之間的天數</a><br />
<a href="http://msdn.microsoft.com/zh-tw/library/system.timespan.aspx" target="_blank">TimeSpan MSDN</a></p>
<p>　</p>
]]></content:encoded>
			<wfw:commentRss>http://m955.com/wp/archives/186/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>列舉 (enum) 資料型別</title>
		<link>http://m955.com/wp/archives/184</link>
		<comments>http://m955.com/wp/archives/184#comments</comments>
		<pubDate>Mon, 02 Feb 2009 14:55:16 +0000</pubDate>
		<dc:creator>blue955</dc:creator>
				<category><![CDATA[程式]]></category>
		<category><![CDATA[C#]]></category>

		<guid isPermaLink="false">http://m955.com/wp/?p=184</guid>
		<description><![CDATA[　　enum 是一種用來宣告列舉型別 (Enumeration Type) 的關鍵字，是一組列舉清單項目的具名常數所構成的特殊型別，emun 主要目的在提高程式的可讀性，及易維護性，使用 enum 有以下幾點需要注意... ]]></description>
			<content:encoded><![CDATA[<p>　　enum 是一種用來宣告列舉型別 (Enumeration Type) 的關鍵字，是一組列舉清單項目的具名常數所構成的特殊型別，emun 主要目的在提高程式的可讀性，及易維護性，使用 enum 有以下幾點需要注意：</p>
<ol>
<li>enum 不能使用於方法 (Method) 內宣告。</li>
<li>資料型別必須是 byte,sbyte,short,ushort,int,uint,long 或 ulong。</li>
<li>預設資料型別為 int。</li>
<li>float 與 double 不可為 enum 的資料型別。</li>
</ol>
<p>關於列舉的宣告方式如下：</p>
<table id="table_code" border="1">
<tr>
<td>
[存取修飾詞] enum [列舉名稱] : [資料型別]<br />
{<br />
　　[成員1],<br />
　　[成員2],<br />
　　...<br />
　　[成員n]<br />
}
  </td>
</tr>
</table>
<p>　</p>
<p>關列舉範例程式如下：</p>
<div class="igBar"><span id="lcsharp-12"><a href="#" onclick="javascript:showPlainTxt('csharp-12'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">C#:</span>
<div id="csharp-12">
<div class="csharp">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0600FF;">public</span> <span style="color: #FF0000;">enum</span> student : <span style="color: #FF0000;">short</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#123;</span> </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 周杰倫 = <span style="color: #FF0000;color:#800000;">1</span>,</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 方文山 = <span style="color: #FF0000;color:#800000;">2</span>,</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 蔡依林 = <span style="color: #FF0000;color:#800000;">3</span>,</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 王立宏 = <span style="color: #FF0000;color:#800000;">4</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">private</span> <span style="color: #0600FF;">void</span> button1_Click<span style="color: #000000;">&#40;</span><span style="color: #FF0000;">object</span> sender, EventArgs e<span style="color: #000000;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008080; font-style: italic;">//將combox的文字數字轉換成短整數</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #FF0000;">short</span> num = <span style="color: #FF0000;color:#800000;">0</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">if</span> <span style="color: #000000;">&#40;</span>cbox.<span style="color: #0000FF;">Text</span> != <span style="color: #808080;">""</span><span style="color: #000000;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; num = <span style="color: #FF0000;">short</span>.<span style="color: #0000FF;">Parse</span><span style="color: #000000;">&#40;</span>cbox.<span style="color: #0000FF;">Text</span><span style="color: #000000;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">switch</span> <span style="color: #000000;">&#40;</span>num<span style="color: #000000;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#123;</span> </div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">case</span> <span style="color: #000000;">&#40;</span><span style="color: #FF0000;">short</span><span style="color: #000000;">&#41;</span> student.周杰倫:</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; MessageBox.<span style="color: #0000FF;">Show</span><span style="color: #000000;">&#40;</span><span style="color: #808080;">"周杰倫"</span>, <span style="color: #808080;">"明星"</span><span style="color: #000000;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">break</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">case</span> <span style="color: #000000;">&#40;</span><span style="color: #FF0000;">short</span><span style="color: #000000;">&#41;</span> student.蔡依林:</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; MessageBox.<span style="color: #0000FF;">Show</span><span style="color: #000000;">&#40;</span><span style="color: #808080;">"蔡依林"</span>, <span style="color: #808080;">"明星"</span><span style="color: #000000;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">break</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">case</span> <span style="color: #000000;">&#40;</span><span style="color: #FF0000;">short</span><span style="color: #000000;">&#41;</span> student.方文山:</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; MessageBox.<span style="color: #0000FF;">Show</span><span style="color: #000000;">&#40;</span><span style="color: #808080;">"方文山"</span>, <span style="color: #808080;">"明星"</span><span style="color: #000000;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">break</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">case</span> <span style="color: #000000;">&#40;</span><span style="color: #FF0000;">short</span><span style="color: #000000;">&#41;</span> student.王立宏:</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; MessageBox.<span style="color: #0000FF;">Show</span><span style="color: #000000;">&#40;</span><span style="color: #808080;">"王立宏"</span>, <span style="color: #808080;">"明星"</span><span style="color: #000000;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">break</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">default</span>:</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; MessageBox.<span style="color: #0000FF;">Show</span><span style="color: #000000;">&#40;</span><span style="color: #808080;">"所選取數值不在範圍中"</span>,<span style="color: #808080;">"注意"</span><span style="color: #000000;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">break</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p><img src="http://farm4.static.flickr.com/3457/3246977289_e5f24e103a_o.png"></img></p>
<p><img src="http://farm4.static.flickr.com/3103/3246977333_71ce6b1b13_o.png"></img></p>
]]></content:encoded>
			<wfw:commentRss>http://m955.com/wp/archives/184/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>結構 (struct) 資料型別</title>
		<link>http://m955.com/wp/archives/183</link>
		<comments>http://m955.com/wp/archives/183#comments</comments>
		<pubDate>Sat, 31 Jan 2009 17:38:46 +0000</pubDate>
		<dc:creator>blue955</dc:creator>
				<category><![CDATA[程式]]></category>
		<category><![CDATA[C#]]></category>

		<guid isPermaLink="false">http://m955.com/wp/?p=183</guid>
		<description><![CDATA[struct 是一種用來宣告結構的關鍵字，在結構中包含相關變數，可以將結構視為變數群組，以學生資料 (student) 來說，若要設計其結構，應該包含幾個相關變數，如：學號(num)，姓名(name)、電話(te... ]]></description>
			<content:encoded><![CDATA[<p>struct 是一種用來宣告結構的關鍵字，在結構中包含相關變數，可以將結構視為變數群組，以學生資料 (student) 來說，若要設計其結構，應該包含幾個相關變數，如：學號(num)，姓名(name)、電話(tel)、手機(mobile)、地址(address)等，底下介紹結構的宣告及叫用方式：</p>
<p>結構 (struct) 宣告方式：</p>
<table id="table_code" border="1">
<tr>
<td>
[存取修飾詞] struct [結構名稱]<br />
{<br />
　　[存取修飾詞] [資料型別] [變數名稱];<br />
　　[存取修飾詞] [資料型別] [變數名稱];<br />
　　...<br />
}
  </td>
</tr>
</table>
<p>　</p>
<p>結構 (struct) 叫用方式：</p>
<table id="table_code" border="1">
<tr>
<td>
[結構名稱] [變數名稱];
  </td>
</tr>
</table>
<p>　</p>
<p>語法範例：</p>
<div class="igBar"><span id="lcsharp-14"><a href="#" onclick="javascript:showPlainTxt('csharp-14'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">C#:</span>
<div id="csharp-14">
<div class="csharp">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0600FF;">public</span> <span style="color: #FF0000;">struct</span> Student</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">public</span> <span style="color: #FF0000;">string</span> Num;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">public</span> <span style="color: #FF0000;">string</span> Name;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">public</span> <span style="color: #FF0000;">string</span> Tel;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">public</span> <span style="color: #FF0000;">string</span> Mobile;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">public</span> <span style="color: #FF0000;">string</span> Address;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">private</span> <span style="color: #0600FF;">void</span> btnAdd_Click<span style="color: #000000;">&#40;</span><span style="color: #FF0000;">object</span> sender, EventArgs e<span style="color: #000000;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008080; font-style: italic;">//宣告結構</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Student std;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008080; font-style: italic;">//指定成員變數</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; std.<span style="color: #0000FF;">Num</span> = txtNum.<span style="color: #0000FF;">Text</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; std.<span style="color: #0000FF;">Name</span> = txtName.<span style="color: #0000FF;">Text</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; std.<span style="color: #0000FF;">Tel</span> = txtTel.<span style="color: #0000FF;">Text</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; std.<span style="color: #0000FF;">Mobile</span> = txtMobile.<span style="color: #0000FF;">Text</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; std.<span style="color: #0000FF;">Address</span> = txtAddress.<span style="color: #0000FF;">Text</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #FF0000;">String</span> msg = <span style="color: #808080;">""</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; msg = msg + <span style="color: #808080;">"學號："</span> + std.<span style="color: #0000FF;">Num</span> + <span style="color: #808080;">"<span style="color: #008080; font-weight: bold;">\n</span>"</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; msg = msg + <span style="color: #808080;">"姓名："</span> + std.<span style="color: #0000FF;">Name</span> + <span style="color: #808080;">"<span style="color: #008080; font-weight: bold;">\n</span>"</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; msg = msg + <span style="color: #808080;">"電話："</span> + std.<span style="color: #0000FF;">Tel</span> + <span style="color: #808080;">"<span style="color: #008080; font-weight: bold;">\n</span>"</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; msg = msg + <span style="color: #808080;">"手機："</span> + std.<span style="color: #0000FF;">Mobile</span> + <span style="color: #808080;">"<span style="color: #008080; font-weight: bold;">\n</span>"</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; msg = msg + <span style="color: #808080;">"地址："</span> + std.<span style="color: #0000FF;">Address</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; MessageBox.<span style="color: #0000FF;">Show</span><span style="color: #000000;">&#40;</span>msg, <span style="color: #808080;">"學生基本資料"</span><span style="color: #000000;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p><img src="http://farm4.static.flickr.com/3257/3241098181_89a0bfb401_o.png" alt="" /> </p>
<p><img src="http://farm4.static.flickr.com/3079/3241943046_c7b3fbe888_o.png" alt="" /></p>
]]></content:encoded>
			<wfw:commentRss>http://m955.com/wp/archives/183/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>列舉、結構、類別的比較表</title>
		<link>http://m955.com/wp/archives/182</link>
		<comments>http://m955.com/wp/archives/182#comments</comments>
		<pubDate>Sat, 31 Jan 2009 16:12:57 +0000</pubDate>
		<dc:creator>blue955</dc:creator>
				<category><![CDATA[程式]]></category>
		<category><![CDATA[C#]]></category>

		<guid isPermaLink="false">http://m955.com/wp/?p=182</guid>
		<description><![CDATA[


enum
struct
class


中文意義
列舉
結構
類別


成員資料型別
受限制、而且只能為整數型別
不受限制
不受限制


叫用方法
直接輸入列舉名稱
宣告結構變數
宣告類別變數


使用 static 修飾詞
否
... ]]></description>
			<content:encoded><![CDATA[<table id="table_style" border="1">
<tr>
<td bgcolor="#dddddd"></td>
<td bgcolor="#dddddd">enum</td>
<td bgcolor="#dddddd">struct</td>
<td bgcolor="#dddddd">class</td>
</tr>
<tr>
<td bgcolor="#dddddd">中文意義</td>
<td>列舉</td>
<td>結構</td>
<td>類別</td>
</tr>
<tr>
<td bgcolor="#dddddd">成員資料型別</td>
<td>受限制、而且只能為整數型別</td>
<td>不受限制</td>
<td>不受限制</td>
</tr>
<tr>
<td bgcolor="#dddddd">叫用方法</td>
<td>直接輸入列舉名稱</td>
<td>宣告結構變數</td>
<td>宣告類別變數</td>
</tr>
<tr>
<td bgcolor="#dddddd">使用 static 修飾詞</td>
<td>否</td>
<td>否</td>
<td>可</td>
</tr>
<tr>
<td bgcolor="#dddddd">包含事件及方法</td>
<td>否</td>
<td>可</td>
<td>可</td>
</tr>
<tr>
<td bgcolor="#dddddd">介面實作</td>
<td>否</td>
<td>可</td>
<td>可</td>
</tr>
<tr>
<td bgcolor="#dddddd">結構函式</td>
<td>否</td>
<td>可</td>
<td>可</td>
</tr>
<tr>
<td bgcolor="#dddddd">型別系統</td>
<td>Value Type</td>
<td>Value Type</td>
<td>Reference Type</td>
</tr>
<tr>
<td bgcolor="#dddddd">預設傳遞參數方式</td>
<td>Call by Value</td>
<td>Call by Value</td>
<td>Call by Reference</td>
</tr>
<tr>
<td bgcolor="#dddddd">實體存放記憶體在Stack或Heap</td>
<td>Stack</td>
<td>Stack</td>
<td>Heap</td>
</tr>
<tr>
<td bgcolor="#dddddd">欄位初始設定式</td>
<td>否</td>
<td>否</td>
<td>可</td>
</tr>
<tr>
<td bgcolor="#dddddd">指派成員內容值</td>
<td>可以，只能整數</td>
<td>否</td>
<td>可</td>
</tr>
<tr>
<td bgcolor="#dddddd">功能</td>
<td>簡單</td>
<td>普通</td>
<td>較強</td>
</tr>
</table>
<p>　</p>
<p>結構 (struct) 宣告方式：</p>
<table id="table_code" border="1">
<tr>
<td>
[存取修飾詞] struct [結構名稱]<br />
{<br />
　　[存取修飾詞] [資料型別] [變數名稱];<br />
　　[存取修飾詞] [資料型別] [變數名稱];<br />
　　...<br />
}
  </td>
</tr>
</table>
<p>　</p>
<p>列舉 (enum) 宣告方式：</p>
<table id="table_code" border="1">
<tr>
<td>
[存取修飾詞] enum [列舉名稱] : [資料型別]<br />
{<br />
　　[成員1],<br />
　　[成員2],<br />
　　...<br />
　　[成員n]<br />
}
  </td>
</tr>
</table>
<p>　</p>
]]></content:encoded>
			<wfw:commentRss>http://m955.com/wp/archives/182/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>[客戶管理程式開發] 雛形</title>
		<link>http://m955.com/wp/archives/179</link>
		<comments>http://m955.com/wp/archives/179#comments</comments>
		<pubDate>Wed, 24 Dec 2008 17:08:26 +0000</pubDate>
		<dc:creator>blue955</dc:creator>
				<category><![CDATA[程式]]></category>

		<guid isPermaLink="false">http://m955.com/wp/archives/179</guid>
		<description><![CDATA[ 
前些日子有做到到客戶關係管理的簡報，突然有的開發的動機，本程式採用 C# 撰寫，目前正在開發階段，未來不排除朝開放原始碼方向，大家集思廣益，功能方面目前還在思考當中，基本上... ]]></description>
			<content:encoded><![CDATA[<p><a href="http://farm4.static.flickr.com/3127/3133682180_3e5ea71a6c_o.png" target="_blank" rel="lightbox"><img src="http://farm4.static.flickr.com/3127/3133682180_01d1be6731.jpg" /></a> </p>
<p>前些日子有做到到客戶關係管理的簡報，突然有的開發的動機，本程式採用 C# 撰寫，目前正在開發階段，未來不排除朝開放原始碼方向，大家集思廣益，功能方面目前還在思考當中，基本上該有的功能應該都會有。</p>
<p>今天完成了基本的介面，以及資料繫結的項目，放個照片上來，讓大家有個印象。</p>
]]></content:encoded>
			<wfw:commentRss>http://m955.com/wp/archives/179/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Access 常用時間日期函數</title>
		<link>http://m955.com/wp/archives/178</link>
		<comments>http://m955.com/wp/archives/178#comments</comments>
		<pubDate>Wed, 24 Dec 2008 16:47:41 +0000</pubDate>
		<dc:creator>blue955</dc:creator>
				<category><![CDATA[程式]]></category>
		<category><![CDATA[Access]]></category>

		<guid isPermaLink="false">http://m955.com/wp/archives/178</guid>
		<description><![CDATA[以下是日期函數用法，提供你方式，你自己可以做到的： 
Year()函數：取得日期資料內的年份值   Year(#2003/03/01#)，顯示結果2003

Month()函數：取得日期資料內的月份值   Month(#2003/03/01#)，顯示結果0... ]]></description>
			<content:encoded><![CDATA[<p>以下是日期函數用法，提供你方式，你自己可以做到的： </p>
<p>Year()函數：取得日期資料內的年份值   <br />Year(#2003/03/01#)，顯示結果2003</p>
<p><span id="more-178"></span></p>
<p>Month()函數：取得日期資料內的月份值   <br />Month(#2003/03/01#)，顯示結果03 </p>
<p>Day()函數：取得日期資料內的日期值   <br />Day(#2003/03/01#)，顯示結果01 </p>
<p>Format()函數：顯示今天的日期為今年的第幾週   <br />Format(Now().ww)，其中ww為1~53週期數值 </p>
<p>DatePart()函數：取得日期資料內的西元年份值   <br />DatePart('yyyy',[訂貨日期])，顯示訂貨日期欄位的西元年份 </p>
<p>DatePart()函數：取得日期資料內的月份值   <br />DatePart('m',[訂貨日期])，顯示訂貨日期欄位的月份(個位數月份顯示一位數)    <br />Format(DatePart('m',[訂貨日期]),'00')，顯示訂貨日期欄位的月份(月份顯示兩位數) </p>
<p>DateAdd()函數：取得日期資料內的年份值   <br />DateAdd('y',-5.[訂貨日期])，顯示訂貨日期欄位往前5天的資料記錄 </p>
<p>DateDiff()函數：取得日期資料內的日期值   <br />DateDiff('d',[訂貨日期].[出貨日期])，顯示訂貨日期與出貨日期兩欄位之間的相差天數 </p>
<p>設定查詢的日期為上星期一及上星期六之間的函數   <br />between DateAdd('d', 0 - (Weekday(Date) + 5), Date) and DateAdd('d', 0 - Weekday(Date), Date) </p>
<p>其他參考：<a href="http://support.microsoft.com/kb/210604/zh-tw" target="_blank">http://support.microsoft.com/kb/210604/zh-tw</a></p>
]]></content:encoded>
			<wfw:commentRss>http://m955.com/wp/archives/178/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>C# 比較字串</title>
		<link>http://m955.com/wp/archives/174</link>
		<comments>http://m955.com/wp/archives/174#comments</comments>
		<pubDate>Mon, 08 Dec 2008 15:53:40 +0000</pubDate>
		<dc:creator>blue955</dc:creator>
				<category><![CDATA[程式]]></category>
		<category><![CDATA[C#]]></category>

		<guid isPermaLink="false">http://m955.com/wp/archives/174</guid>
		<description><![CDATA[C# 屬於強型別的資料型態，所以在型別方面，編譯器檢查的很嚴格，所以一些在 VB.NET 中習慣的用法，拿到 C# 中就會出現錯誤。
舉例來說 C# 不能使用 0 或 1 來替代布林值，而字串也不能直接比... ]]></description>
			<content:encoded><![CDATA[<p>C# 屬於強型別的資料型態，所以在型別方面，編譯器檢查的很嚴格，所以一些在 VB.NET 中習慣的用法，拿到 C# 中就會出現錯誤。</p>
<p>舉例來說 C# 不能使用 0 或 1 來替代布林值，而字串也不能直接比較，這對我們剛開始會造成一些困擾！下面 VB.NET 的用法如果拿到 C# 中使用就會出錯</p>
<div class="igBar"><span id="lvbnet-17"><a href="#" onclick="javascript:showPlainTxt('vbnet-17'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">VB.NET:</span>
<div id="vbnet-17">
<div class="vbnet">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0600FF;">Dim</span> a <span style="color: #FF8000;">As</span> <span style="color: #FF8000;">String</span> = <span style="color: #808080;">"111"</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0600FF;">Dim</span> b <span style="color: #FF8000;">As</span> <span style="color: #FF8000;">String</span> = <span style="color: #808080;">"111"</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0600FF;">IF</span> a = b <span style="color: #FF8000;">THEN</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">...</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0600FF;">END</span> <span style="color: #0600FF;">IF</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p>  </p>
<p>C# 針對比較字串有兩個比較常用的函數：</p>
<p>String.Compare&#160; 比較兩個字串的值。傳回整數值   <br />String.Equals 比較兩個字串的值。傳回布林值</p>
<p>C#中改用比較字串的函數</p>
<div class="igBar"><span id="lcsharp-18"><a href="#" onclick="javascript:showPlainTxt('csharp-18'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">C#:</span>
<div id="csharp-18">
<div class="csharp">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #FF0000;">String</span> a = <span style="color: #808080;">"111"</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #FF0000;">String</span> b = <span style="color: #808080;">"222"</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0600FF;">if</span><span style="color: #000000;">&#40;</span><span style="color: #FF0000;">String</span>.<span style="color: #0000FF;">Equals</span><span style="color: #000000;">&#40;</span>a,b<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; ....</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0600FF;">else</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; ....</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>參考資料：<a href="http://msdn.microsoft.com/zh-tw/library/fbh501kz(VS.80).aspx" target="_blank">C#比較字串(MSDN)</a></p>
]]></content:encoded>
			<wfw:commentRss>http://m955.com/wp/archives/174/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>SQL Server 中易混淆的數據類型</title>
		<link>http://m955.com/wp/archives/173</link>
		<comments>http://m955.com/wp/archives/173#comments</comments>
		<pubDate>Mon, 08 Dec 2008 15:27:39 +0000</pubDate>
		<dc:creator>blue955</dc:creator>
				<category><![CDATA[程式]]></category>
		<category><![CDATA[ADO.NET]]></category>
		<category><![CDATA[SQL]]></category>

		<guid isPermaLink="false">http://m955.com/wp/archives/173</guid>
		<description><![CDATA[本文摘自「藍色理想」http://www.blueidea.com/tech/program/2004/1724.asp。
(1)char、varchar、text和nchar、nvarchar、ntext   char 和varchar的長度都在1到8000之間，它們的區別在於char是定長字符數據，而varchar是變長... ]]></description>
			<content:encoded><![CDATA[<p>本文摘自「藍色理想」<a href="http://www.blueidea.com/tech/program/2004/1724.asp。" target="_blank">http://www.blueidea.com/tech/program/2004/1724.asp。</a></p>
<p>(1)char、varchar、text和nchar、nvarchar、ntext   <br />char 和varchar的長度都在1到8000之間，它們的區別在於char是定長字符數據，而varchar是變長字符數據。所謂定長就是長度固定的，當輸入的數據長度沒有達到指定的長度時將自動以英文空格在其後面填充，使長度達到相應的長度；而變長字符數據則不會以空格填充。text存儲可變長度的非 Unicode數據，最大長度為2^31-1(2,147,483,647)個字符。 </p>
<p>後面三種數據類型和前面的相比，從名稱上看只是多了個字母&quot;n&quot;，它表示存儲的是Unicode數據類型的字符。寫過程序的朋友對Unicode應該很瞭解。字符中，英文字符只需要一個字節存儲就足夠了，但漢字眾多，需要兩個字節存儲，英文與漢字同時存在時容易造成混亂，Unicode字符集就是為瞭解決字符集這種不兼容的問題而產生的，它所有的字符都用兩個字節表示，即英文字符也是用兩個字節表示。nchar、nvarchar的長度是在1到4000之間。和char、varchar比較：nchar、nvarchar則最多存儲4000個字符，不論是英文還是漢字；而char、varchar最多能存儲8000個英文，4000個漢字。可以看出使用nchar、nvarchar數據類型時不用擔心輸入的字符是英文還是漢字，較為方便，但在存儲英文時數量上有些損失。 </p>
<p>(2)datetime和smalldatetime   <br />datetime：從1753年1月1日到9999年12月31日的日期和時間數據，精確到百分之三秒。    <br />smalldatetime：從1900年1月1日到2079年6月6日的日期和時間數據，精確到分鍾。 </p>
<p>(3)bitint、int、smallint、tinyint和bit   <br />bigint：從-2^63(-9223372036854775808)到2^63-1(9223372036854775807)的整型數據。    <br />int：從-2^31(-2,147,483,648)到2^31-1(2,147,483,647)的整型數據。    <br />smallint：從-2^15(-32,768)到2^15-1(32,767)的整數數據。    <br />tinyint：從0到255的整數數據。    <br />bit：1或0的整數數據。 </p>
<p>(4)decimal和numeric   <br />這兩種數據類型是等效的。都有兩個參數：p（精度）和s（小數位數）。p指定小數點左邊和右邊可以存儲的十進制數字的最大個數，p必須是從 1到38之間的值。s指定小數點右邊可以存儲的十進制數字的最大個數，s必須是從0到p之間的值，默認小數位數是0。 </p>
<p>(5)float和real   <br />float：從-1.79^308到1.79^308之間的浮點數字數據。    <br />real：從-3.40^38到3.40^38之間的浮點數字數據。在SQL Server中，real的同義詞為float(24)。</p>
]]></content:encoded>
			<wfw:commentRss>http://m955.com/wp/archives/173/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>如何將 Excel 資料匯入SQL Server 2005 Express</title>
		<link>http://m955.com/wp/archives/169</link>
		<comments>http://m955.com/wp/archives/169#comments</comments>
		<pubDate>Tue, 25 Nov 2008 00:50:45 +0000</pubDate>
		<dc:creator>blue955</dc:creator>
				<category><![CDATA[程式]]></category>
		<category><![CDATA[SQL]]></category>

		<guid isPermaLink="false">http://m955.com/wp/archives/169</guid>
		<description><![CDATA[微軟現在也想搞自由軟體這一套，連續推出了 Express 系列，不過不免詬病一下，既然要免費了為何不開放多一點功能，像 SQL Server 2005 Express 就少了很多功能，不過就整體看起來，還是比 Access ... ]]></description>
			<content:encoded><![CDATA[<p>微軟現在也想搞自由軟體這一套，連續推出了 Express 系列，不過不免詬病一下，既然要免費了為何不開放多一點功能，像 SQL Server 2005 Express 就少了很多功能，不過就整體看起來，還是比 Access 好多了。</p>
<p>SQL Server 2005 Express 有 SQL Server Management Studio Express 來進行圖形化管理，不過卻沒有匯入匯出的功能，有點不方便，但是可以利用其他方法來達成這個匯入功能。</p>
<p>但要使用SQL指令匯入需要先開啟OPENROWSET才能執行匯入功能。
<p>依序操作如下：
<p>Microsoft SQL Server 2005 &gt; 組態工具 &gt; SQL Server 2005 介面組態 &gt; 功能的介面區組態 &gt; 勾選「啟用OPENROWSET和OPENDATASOURCE支援」
<p><a href="http://farm4.static.flickr.com/3249/3056754101_173886c058_o.jpg" target="_blank" rel="lightbox"><img src="http://farm4.static.flickr.com/3249/3056754101_c00c38729c.jpg"></a>
<p>將要匯入的Excel檔就定位，例如放在D:\testdata\zipcode.xls，檢查一下，第一行是欄位名稱，第二行起是資料的部分，然後工作表名稱可以維持原本的Sheet1或是自己重新命名（記得下面的Sheet1$要配合修改） <br />接著就可以執行</p>
<div class="igBar"><span id="lsql-20"><a href="#" onclick="javascript:showPlainTxt('sql-20'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">SQL:</span>
<div id="sql-20">
<div class="sql">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #993333; font-weight: bold;">SELECT</span> * <span style="color: #993333; font-weight: bold;">INTO</span> zone <span style="color: #993333; font-weight: bold;">FROM</span> OPENROWSET<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color: #ff0000;">'Microsoft.Jet.OLEDB.4.0'</span>,</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #ff0000;">'Excel 8.0;Database=D:<span style="color: #000099; font-weight: bold;">\t</span>estdata<span style="color: #000099; font-weight: bold;">\z</span>ipcode.xls'</span>, <span style="color:#006600; font-weight:bold;">&#91;</span>Sheet1$<span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#41;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
]]></content:encoded>
			<wfw:commentRss>http://m955.com/wp/archives/169/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>C# 陣列的宣告方式</title>
		<link>http://m955.com/wp/archives/165</link>
		<comments>http://m955.com/wp/archives/165#comments</comments>
		<pubDate>Tue, 11 Nov 2008 10:13:27 +0000</pubDate>
		<dc:creator>blue955</dc:creator>
				<category><![CDATA[程式]]></category>
		<category><![CDATA[C#]]></category>

		<guid isPermaLink="false">http://m955.com/wp/archives/165</guid>
		<description><![CDATA[剛開始接觸 C# ，它的宣告方式跟 C/C++，表面上看起來好像相同，不過仔細一看，卻和我習慣方式不一樣，例如在 VB 裡宣告一個陣列：Dim arr1() As String = { }， 在 C# 裡面卻是這樣宣告的：String[] ar... ]]></description>
			<content:encoded><![CDATA[<p>剛開始接觸 C# ，它的宣告方式跟 C/C++，表面上看起來好像相同，不過仔細一看，卻和我習慣方式不一樣，例如在 VB 裡宣告一個陣列：Dim arr1() As String = { }， 在 C# 裡面卻是這樣宣告的：String[] arr1 = { };，有點不習慣，不過看久了也還好。</p>
<p><span id="more-165"></span></p>
<p>以下是一些陣列的宣告方式：</p>
<div class="igBar"><span id="lcsharp-22"><a href="#" onclick="javascript:showPlainTxt('csharp-22'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">C#:</span>
<div id="csharp-22">
<div class="csharp">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0600FF;">using</span> <span style="color: #000000;">System</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0600FF;">namespace</span> ConsoleApplication1</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #FF0000;">class</span> Program</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #000000;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">static</span> <span style="color: #0600FF;">void</span> Main<span style="color: #000000;">&#40;</span><span style="color: #FF0000;">string</span><span style="color: #000000;">&#91;</span><span style="color: #000000;">&#93;</span> args<span style="color: #000000;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008080; font-style: italic;">//第1種宣告方式</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #FF0000;">string</span><span style="color: #000000;">&#91;</span><span style="color: #000000;">&#93;</span> arr1 = <a href="http://www.google.com/search?q=new+msdn.microsoft.com" target="_blank"><span style="color: #008000;">new</span></a> <span style="color: #FF0000;">string</span><span style="color: #000000;">&#91;</span><span style="color: #FF0000;color:#800000;">5</span><span style="color: #000000;">&#93;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008080; font-style: italic;">//第2種宣告方式，不指定陣列大小</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #FF0000;">string</span><span style="color: #000000;">&#91;</span><span style="color: #000000;">&#93;</span> arr2 = <a href="http://www.google.com/search?q=new+msdn.microsoft.com" target="_blank"><span style="color: #008000;">new</span></a> <span style="color: #FF0000;">string</span><span style="color: #000000;">&#91;</span><span style="color: #000000;">&#93;</span> </div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#123;</span><span style="color: #808080;">"王家豪"</span>, <span style="color: #808080;">"鄭惠婷"</span>, <span style="color: #808080;">"蔡昱友"</span>, <span style="color: #808080;">"蔡雅芳"</span>, <span style="color: #808080;">"林嬌岳"</span><span style="color: #000000;">&#125;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008080; font-style: italic;">//第3種宣告方式，直接指定初值，比較方便</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #FF0000;">string</span><span style="color: #000000;">&#91;</span><span style="color: #000000;">&#93;</span> arr3 = <span style="color: #000000;">&#123;</span> <span style="color: #808080;">"陳苑星"</span>, <span style="color: #808080;">"陳宏行"</span>, <span style="color: #808080;">"陳麗娟"</span>, <span style="color: #808080;">"趙智和"</span>, <span style="color: #808080;">"白嘉鳳"</span> <span style="color: #000000;">&#125;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008080; font-style: italic;">//多維陣列</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #FF0000;">string</span><span style="color: #000000;">&#91;</span>,<span style="color: #000000;">&#93;</span> arr4 = <span style="color: #000000;">&#123;</span> <span style="color: #000000;">&#123;</span> <span style="color: #808080;">"王"</span>, <span style="color: #808080;">"趙"</span>, <span style="color: #808080;">"白"</span> <span style="color: #000000;">&#125;</span>, <span style="color: #000000;">&#123;</span> <span style="color: #808080;">"陳"</span>, <span style="color: #808080;">"蔡"</span>, <span style="color: #808080;">"郭"</span> <span style="color: #000000;">&#125;</span> <span style="color: #000000;">&#125;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008080; font-style: italic;">//讀出arr3</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">for</span> <span style="color: #000000;">&#40;</span><span style="color: #FF0000;">int</span> i = <span style="color: #FF0000;color:#800000;">0</span>; i &lt;<span style="color: #FF0000;color:#800000;">5</span>; i++<span style="color: #000000;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Console.<span style="color: #0000FF;">Write</span><span style="color: #000000;">&#40;</span>arr3<span style="color: #000000;">&#91;</span>i<span style="color: #000000;">&#93;</span> + <span style="color: #808080;">"<span style="color: #008080; font-weight: bold;">\n</span>"</span><span style="color: #000000;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008080; font-style: italic;">//讀出arr4</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">for</span> <span style="color: #000000;">&#40;</span><span style="color: #FF0000;">int</span> j = <span style="color: #FF0000;color:#800000;">0</span>; j &lt;<span style="color: #FF0000;color:#800000;">2</span>; j++<span style="color: #000000;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">for</span> <span style="color: #000000;">&#40;</span><span style="color: #FF0000;">int</span> n = <span style="color: #FF0000;color:#800000;">0</span>; n &lt;<span style="color: #FF0000;color:#800000;">3</span>; n++<span style="color: #000000;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Console.<span style="color: #0000FF;">Write</span><span style="color: #000000;">&#40;</span>arr4<span style="color: #000000;">&#91;</span>j, n<span style="color: #000000;">&#93;</span> + <span style="color: #808080;">"<span style="color: #008080; font-weight: bold;">\n</span>"</span><span style="color: #000000;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Console.<span style="color: #0000FF;">ReadLine</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #000000;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
]]></content:encoded>
			<wfw:commentRss>http://m955.com/wp/archives/165/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>C# 簡介</title>
		<link>http://m955.com/wp/archives/164</link>
		<comments>http://m955.com/wp/archives/164#comments</comments>
		<pubDate>Tue, 11 Nov 2008 03:34:56 +0000</pubDate>
		<dc:creator>blue955</dc:creator>
				<category><![CDATA[程式]]></category>
		<category><![CDATA[C#]]></category>

		<guid isPermaLink="false">http://m955.com/wp/archives/164</guid>
		<description><![CDATA[&#160;&#160;&#160;&#160;&#160;&#160; 好吧！我知道我必須踏入這個萬惡的深淵裡，在現今兩大主流 (JAVA、C#) 中尋找最適合我的武器，雖然我很喜歡 VB，但是看在正規的程式設計師眼中，VB 就像是玩具一... ]]></description>
			<content:encoded><![CDATA[<p>&#160;&#160;&#160;&#160;&#160;&#160; 好吧！我知道我必須踏入這個萬惡的深淵裡，在現今兩大主流 (JAVA、C#) 中尋找最適合我的武器，雖然我很喜歡 VB，但是看在正規的程式設計師眼中，VB 就像是玩具一般，尤其上課老師談到 VB 時，眼中流露出的不屑，真是令我感到萬般不自在，真想舉手幹橋他一番，VB 不是原罪，在 DOT.NET 時代中，VB 已經蛻化成完整物件導向語言，加上多執行緒、泛型，其實真的沒什麼好詬病的，VB 不再是玩具，不再是小孩玩泥巴，不過也大大提高了學習的曲線。</p>
<p><span id="more-164"></span></p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; 一開始對 C# 的確是沒什麼好感，不過微軟頃全力資源要拱這個語言出線，與 JAVA 抗衡，令人不得不正視它的存在，沒有什麼視窗軟體是 VB 寫不出來的，以上這句話沒錯，不過在現今 NET 時代來臨，跨平台也成為各大廠逐鹿中原的條件之一，手機、LINUX 市場，數位家電、嵌入式平台，成為最大未開發地帶。</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; 無疑的，在桌面作業系統方面，微軟是最大贏家，其地位在未來幾十年應該還無法撼動，但在其他領域，可就未必了，微軟有認知到這一點，所以提倡出 C# 的雛形，而後有 Inter 及 HP 加入開發，並於 2000 年 10 月將 C# 交由國際標準規範組織，「歐洲電腦廠商協會（ECMA）」審核成為國際標準的程式語言。</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; C# 的出發點在於，提供程式設計師，一個像 VB 容易開發，同時又像 C/C++ 強大的程式語言。</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; 在開發軟體上面，C# 不一定要選擇 Visual Studio，其實只要配合微軟的 <a href="http://msdn.microsoft.com/en-us/windowsvista/bb980924.aspx" target="_blank">SDK</a>，用記事本也可以撰寫 C#，同時在市面上也有許多的開發套件可供選擇，<a href="http://www.mono-project.com/" target="_blank">MONO</a> 就是其中之一，MONO 有 LINUX 版本，可以提供在 LINUX 底下的 C# 開發環境。</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; C# 在語法撰寫上，與 C/C++ 類似，可以讓 JAVA、C/C++ 的程式設計師快速上手。</p>
<p><a href=" http://www.microsoft.com/taiwan/vstudio/express/visualcsharp/" target="_blank"><br />
http://www.microsoft.com/taiwan/vstudio/express/visualcsharp/</a></p>
<p>先來個 Hello World 吧！</p>
<div class="igBar"><span id="lcsharp-24"><a href="#" onclick="javascript:showPlainTxt('csharp-24'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">C#:</span>
<div id="csharp-24">
<div class="csharp">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0600FF;">using</span> <span style="color: #000000;">System</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #FF0000;">class</span> Program</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0600FF;">static</span> <span style="color: #0600FF;">void</span> Main<span style="color: #000000;">&#40;</span><span style="color: #FF0000;">string</span><span style="color: #000000;">&#91;</span><span style="color: #000000;">&#93;</span> args<span style="color: #000000;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #000000;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; Console.<span style="color: #0000FF;">Write</span><span style="color: #000000;">&#40;</span><span style="color: #808080;">"Hello World C#"</span><span style="color: #000000;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; Console.<span style="color: #0000FF;">ReadLine</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #000000;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
]]></content:encoded>
			<wfw:commentRss>http://m955.com/wp/archives/164/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>利用commandbuilder來節省設定屬性與參數步驟</title>
		<link>http://m955.com/wp/archives/150</link>
		<comments>http://m955.com/wp/archives/150#comments</comments>
		<pubDate>Fri, 12 Sep 2008 08:12:40 +0000</pubDate>
		<dc:creator>blue955</dc:creator>
				<category><![CDATA[程式]]></category>
		<category><![CDATA[VB.NET]]></category>

		<guid isPermaLink="false">http://m955.com/wp/?p=150</guid>
		<description><![CDATA[PLAIN TEXT
VB.NET:




'建立 DataAdapter 物件


&#160; &#160; Dim objCmd As New OleDbDataAdapter&#40;"Select * From 成績單", objConn&#41;


'建立 CommandBuilder 物件


&#160; &#160; Dim objCB As OleDbCommandBuilder = New OleDbCommandBuilder&#4... ]]></description>
			<content:encoded><![CDATA[<div class="igBar"><span id="lvbnet-26"><a href="#" onclick="javascript:showPlainTxt('vbnet-26'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">VB.NET:</span>
<div id="vbnet-26">
<div class="vbnet">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #008080; font-style: italic;">'建立 DataAdapter 物件</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0600FF;">Dim</span> objCmd <span style="color: #FF8000;">As</span> <span style="color: #FF8000;">New</span> OleDbDataAdapter<span style="color: #000000;">&#40;</span><span style="color: #808080;">"Select * From 成績單"</span>, objConn<span style="color: #000000;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #008080; font-style: italic;">'建立 CommandBuilder 物件</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0600FF;">Dim</span> objCB <span style="color: #FF8000;">As</span> OleDbCommandBuilder = <span style="color: #FF8000;">New</span> OleDbCommandBuilder<span style="color: #000000;">&#40;</span>objCmd<span style="color: #000000;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #008080; font-style: italic;">'建立 DataSet 物件，並將 SelectCommand 的執行結果置入 DataSet 物件中</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;<span style="color: #0600FF;">Dim</span> DS <span style="color: #FF8000;">As</span> <span style="color: #FF8000;">New</span> DataSet<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;objCmd.<span style="color: #0000FF;">Fill</span><span style="color: #000000;">&#40;</span>DS, <span style="color: #808080;">"成績單"</span><span style="color: #000000;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #008080; font-style: italic;">'建立 myTable 為 DataTable 物件，將 DataSet 物件的成績單資料表指定給 myTable&nbsp; &nbsp; </span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;<span style="color: #0600FF;">Dim</span> myTable <span style="color: #FF8000;">As</span> DataTable = DS.<span style="color: #0000FF;">Tables</span><span style="color: #000000;">&#40;</span><span style="color: #808080;">"成績單"</span><span style="color: #000000;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #008080; font-style: italic;">'修改資料列</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;myTable.<span style="color: #0000FF;">Rows</span><span style="color: #000000;">&#40;</span><span style="color: #FF0000;color:#800000;">6</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#40;</span><span style="color: #808080;">"統計"</span><span style="color: #000000;">&#41;</span> = <span style="color: #FF0000;color:#800000;">80</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #008080; font-style: italic;">'刪除資料列</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;myTable.<span style="color: #0000FF;">Rows</span><span style="color: #000000;">&#40;</span><span style="color: #FF0000;color:#800000;">4</span><span style="color: #000000;">&#41;</span>.<span style="color: #0000FF;">Delete</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #008080; font-style: italic;">'新增資料列</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;<span style="color: #0600FF;">Dim</span> myRow <span style="color: #FF8000;">As</span> DataRow = myTable.<span style="color: #0000FF;">NewRow</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;myRow<span style="color: #000000;">&#40;</span><span style="color: #808080;">"學號"</span><span style="color: #000000;">&#41;</span> = <span style="color: #808080;">"A8608011"</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;myRow<span style="color: #000000;">&#40;</span><span style="color: #808080;">"姓名"</span><span style="color: #000000;">&#41;</span> = <span style="color: #808080;">"小丸子"</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;myRow<span style="color: #000000;">&#40;</span><span style="color: #808080;">"會計"</span><span style="color: #000000;">&#41;</span> = <span style="color: #FF0000;color:#800000;">95</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;myRow<span style="color: #000000;">&#40;</span><span style="color: #808080;">"統計"</span><span style="color: #000000;">&#41;</span> = <span style="color: #FF0000;color:#800000;">70</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;myTable.<span style="color: #0000FF;">Rows</span>.<span style="color: #0000FF;">Add</span><span style="color: #000000;">&#40;</span>myRow<span style="color: #000000;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #008080; font-style: italic;">'將 DataSet 物件的資料更新到來源資料</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;objCmd.<span style="color: #0000FF;">Update</span><span style="color: #000000;">&#40;</span>DS, <span style="color: #808080;">"成績單"</span><span style="color: #000000;">&#41;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
]]></content:encoded>
			<wfw:commentRss>http://m955.com/wp/archives/150/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>16x32 LED 矩陣</title>
		<link>http://m955.com/wp/archives/149</link>
		<comments>http://m955.com/wp/archives/149#comments</comments>
		<pubDate>Thu, 28 Aug 2008 16:21:06 +0000</pubDate>
		<dc:creator>blue955</dc:creator>
				<category><![CDATA[程式]]></category>
		<category><![CDATA[8051]]></category>

		<guid isPermaLink="false">http://m955.com/wp/archives/149</guid>
		<description><![CDATA[在完成了 16X16 的 LED 矩陣後，有一點小心得，所以以此為延伸，製作 16X32 LED 矩陣，用了 512 顆高亮的LED，將電路洗出來是小事，不過光是鑽孔和焊接就整整花掉了我三天的時間，要鑽1024個孔（... ]]></description>
			<content:encoded><![CDATA[<p>在完成了 16X16 的 LED 矩陣後，有一點小心得，所以以此為延伸，製作 16X32 LED 矩陣，用了 512 顆高亮的LED，將電路洗出來是小事，不過光是鑽孔和焊接就整整花掉了我三天的時間，要鑽1024個孔（1顆LED兩個孔），焊接的接點 2048 點（雙面走線，兩面都要焊），相信我，這真不是人幹的！</p>
<p><a title="DSC00772.JPG" href="http://farm4.static.flickr.com/3051/2804932042_044262d582_o.jpg" target="_blank" rel="lightbox"><img alt="DSC00772.JPG" src="http://farm4.static.flickr.com/3051/2804932042_133d4ec53d_m.jpg" border="0" /></a>&#160; 特寫</p>
</p>
<p><span id="more-149"></span></p>
<p><a title="DSC00720.JPG" href="http://farm4.static.flickr.com/3118/2804074631_27fc3d5689_o.jpg" target="_blank" rel="lightbox"><img alt="DSC00720.JPG" src="http://farm4.static.flickr.com/3118/2804074631_c2b295e38a_m.jpg" border="0" /></a>&#160; 正面</p>
<p><a title="DSC00719.JPG" href="http://farm4.static.flickr.com/3062/2804074187_2421d0d4bf_o.jpg" target="_blank" rel="lightbox"><img alt="DSC00719.JPG" src="http://farm4.static.flickr.com/3062/2804074187_14f37b3805_m.jpg" border="0" /></a>&#160; 背面</p>
<p><a title="DSC00721.JPG" href="http://farm4.static.flickr.com/3122/2804921834_e0b8741bb7_o.jpg" target="_blank" rel="lightbox"><img alt="DSC00721.JPG" src="http://farm4.static.flickr.com/3122/2804921834_128cbff589_m.jpg" border="0" /></a>&#160; 測試畫面</p>
<p><a title="DSC00723.JPG" href="http://farm4.static.flickr.com/3212/2804078359_70f18a7bb4_b.jpg" target="_blank" rel="lightbox"><img alt="DSC00723.JPG" src="http://farm4.static.flickr.com/3212/2804078359_70f18a7bb4_m.jpg" border="0" /></a>&#160; 正面測試畫面，爆亮的！</p>
<p>這塊板子採取 LED 部分，和主電路分開，這樣可以提高擴充機能，要是想要增加新的功能，更改主電路部分即可，不用動到 LED 板，相信我，你不會想重做 LED 板的！</p>
<p><a title="DSC00767.JPG" href="http://farm4.static.flickr.com/3148/2804079273_1dd9c5b3bf_o.jpg" target="_blank" rel="lightbox"><img alt="DSC00767.JPG" src="http://farm4.static.flickr.com/3148/2804079273_fa6a7f563e_m.jpg" border="0" /></a>&#160; 主電路</p>
<p><a title="DSC00770.JPG" href="http://farm4.static.flickr.com/3179/2804084487_ebe9b1a06d_b.jpg" target="_blank" rel="lightbox"><img alt="DSC00770.JPG" src="http://farm4.static.flickr.com/3179/2804084487_ebe9b1a06d_m.jpg" border="0" /></a>&#160; 合體</p>
<p><a title="DSC00768.JPG" href="http://farm4.static.flickr.com/3292/2804928924_fd3868e022_b.jpg" target="_blank" rel="lightbox"><img alt="DSC00768.JPG" src="http://farm4.static.flickr.com/3292/2804928924_fd3868e022_m.jpg" border="0" /></a>&#160; 採用連接線連接</p>
<p><a title="DSC00774.JPG" href="http://farm4.static.flickr.com/3014/2804085555_07baa059f0_o.jpg" target="_blank" rel="lightbox"><img alt="DSC00774.JPG" src="http://farm4.static.flickr.com/3014/2804085555_c1eff90427_m.jpg" border="0" /></a>&#160; ISP線上燒錄</p>
<p><a title="DSC00789.JPG" href="http://farm4.static.flickr.com/3266/2804932934_c80a796b14_o.jpg" target="_blank" rel="lightbox"><img alt="DSC00789.JPG" src="http://farm4.static.flickr.com/3266/2804932934_db3de4ace4_m.jpg" border="0" /></a>&#160; 跑程式畫面</p>
<p>LED 光源板電路：</p>
<p>1. 正面 <a href="http://homepage8.seed.net.tw/web@1/line/setup/LED16x32top.pdf" target="_blank">LED16x32top.pdf</a>    <br />2. 背面 <a href="http://homepage8.seed.net.tw/web@1/line/setup/LED16x32bottom.pdf" target="_blank">LED16x32bottom.pdf</a></p>
]]></content:encoded>
			<wfw:commentRss>http://m955.com/wp/archives/149/feed</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>小綠人 18 分解圖</title>
		<link>http://m955.com/wp/archives/148</link>
		<comments>http://m955.com/wp/archives/148#comments</comments>
		<pubDate>Tue, 05 Aug 2008 00:20:35 +0000</pubDate>
		<dc:creator>blue955</dc:creator>
				<category><![CDATA[程式]]></category>
		<category><![CDATA[8051]]></category>

		<guid isPermaLink="false">http://m955.com/wp/archives/148</guid>
		<description><![CDATA[小綠人是由 18 張分解圖所組成的，一張一張播放，就像卡通一樣，眼睛會形成暫留現象，所以看起來就好像在動一樣。
至於如何轉成程式碼？有很多方法，常用的行掃瞄，可以一行一行算 16 ... ]]></description>
			<content:encoded><![CDATA[<p>小綠人是由 18 張分解圖所組成的，一張一張播放，就像卡通一樣，眼睛會形成暫留現象，所以看起來就好像在動一樣。</p>
<p>至於如何轉成程式碼？有很多方法，常用的行掃瞄，可以一行一行算 16 進位碼，另外可以找 LCD 的的像素轉換程式，在畫面上畫上你要的圖案，之後就可以轉成 16 進位碼。</p>
<p><span id="more-148"></span></p>
<p><a title="螢幕截圖00001" href="http://farm4.static.flickr.com/3093/2733898782_269c005856_o.png" target="_blank" class="highslide"  onclick="return hs.expand(this)" rel="lightbox"><img alt="螢幕截圖00001" hspace="hspace" src="http://farm4.static.flickr.com/3093/2733898782_48365d8fee_t.jpg" border="0" /></a>&#160; <a title="螢幕截圖00002" href="http://farm4.static.flickr.com/3001/2733898888_d36b298845_o.png" target="_blank" rel="lightbox"><img alt="螢幕截圖00002" hspace="hspace" src="http://farm4.static.flickr.com/3001/2733898888_bef5c8399e_t.jpg" border="0" /></a>&#160; <a title="螢幕截圖00003" href="http://farm4.static.flickr.com/3137/2733898948_767a7e52e2_o.png" target="_blank" rel="lightbox"><img alt="螢幕截圖00003" hspace="hspace" src="http://farm4.static.flickr.com/3137/2733898948_fe72f76714_t.jpg" border="0" /></a>&#160; <a title="螢幕截圖00004" href="http://farm4.static.flickr.com/3198/2733898844_9862a07b0c_o.png" target="_blank"  rel="lightbox"><img alt="螢幕截圖00004" hspace="hspace" src="http://farm4.static.flickr.com/3198/2733898844_ee1014516a_t.jpg" border="0" /></a>&#160; <a title="螢幕截圖00005" href="http://farm4.static.flickr.com/3257/2733899068_993fdb2500_o.png" target="_blank" rel="lightbox"><img alt="螢幕截圖00005" hspace="hspace" src="http://farm4.static.flickr.com/3257/2733899068_52e7617709_t.jpg" border="0" /></a></p>
<p><a title="螢幕截圖00006" href="http://farm4.static.flickr.com/3245/2733068267_fd2e5a2de4_o.png" target="_blank"  rel="lightbox"><img alt="螢幕截圖00006" hspace="hspace" src="http://farm4.static.flickr.com/3245/2733068267_bdd0819bac_t.jpg" border="0" /></a>&#160; <a title="螢幕截圖00007" href="http://farm4.static.flickr.com/3275/2733068393_3ccfdeab79_o.png" target="_blank" rel="lightbox"><img alt="螢幕截圖00007" hspace="hspace" src="http://farm4.static.flickr.com/3275/2733068393_9ca420208f_t.jpg" border="0" /></a>&#160; <a title="螢幕截圖00008" href="http://farm4.static.flickr.com/3032/2733899226_b451fee7c9_o.png" rel="lightbox" target="_blank"><img alt="螢幕截圖00008" hspace="hspace" src="http://farm4.static.flickr.com/3032/2733899226_63d3db22f8_t.jpg" border="0" /></a>&#160; <a title="螢幕截圖00009" href="http://farm4.static.flickr.com/3004/2733899278_e89fd3739d_o.png" target="_blank" rel="lightbox"><img alt="螢幕截圖00009" hspace="hspace" src="http://farm4.static.flickr.com/3004/2733899278_d4c29c8943_t.jpg" border="0" /></a>&#160; <a title="螢幕截圖00010" href="http://farm4.static.flickr.com/3090/2733068535_d5da6ebea5_o.png" target="_blank" rel="lightbox"><img alt="螢幕截圖00010" hspace="hspace" src="http://farm4.static.flickr.com/3090/2733068535_5e62116cee_t.jpg" border="0" /></a></p>
<p><a title="螢幕截圖00011" href="http://farm4.static.flickr.com/3059/2733068853_cc605348ce_o.png" target="_blank" rel="lightbox"><img alt="螢幕截圖00011" hspace="hspace" src="http://farm4.static.flickr.com/3059/2733068853_638c8c694d_t.jpg" border="0" /></a>&#160; <a title="螢幕截圖00012" href="http://farm4.static.flickr.com/3071/2733068809_4ba9bcd18c_o.png" target="_blank" rel="lightbox"><img alt="螢幕截圖00012" hspace="hspace" src="http://farm4.static.flickr.com/3071/2733068809_ae585cee72_t.jpg" border="0" /></a>&#160; <a title="螢幕截圖00013" href="http://farm4.static.flickr.com/3071/2733899466_00d3c4ff4a_o.png" target="_blank" rel="lightbox"><img alt="螢幕截圖00013" hspace="hspace" src="http://farm4.static.flickr.com/3071/2733899466_a66e0a689e_t.jpg" border="0" /></a>&#160; <a title="螢幕截圖00014" href="http://farm4.static.flickr.com/3108/2733899522_db6bb54dfa_o.png" target="_blank" rel="lightbox"><img alt="螢幕截圖00014" hspace="hspace" src="http://farm4.static.flickr.com/3108/2733899522_34e880b5cd_t.jpg" border="0" /></a>&#160; <a title="螢幕截圖00015" href="http://farm4.static.flickr.com/3209/2733068631_ed93b4edc9_o.png" target="_blank" rel="lightbox"><img alt="螢幕截圖00015" hspace="hspace" src="http://farm4.static.flickr.com/3209/2733068631_b41ec2233b_t.jpg" border="0" /></a></p>
<p><a title="螢幕截圖00016" href="http://farm4.static.flickr.com/3251/2733899796_726e063f04_o.png" target="_blank" rel="lightbox"><img alt="螢幕截圖00016" hspace="hspace" src="http://farm4.static.flickr.com/3251/2733899796_ba9db38ab6_t.jpg" border="0" /></a>&#160; <a title="螢幕截圖00017" href="http://farm4.static.flickr.com/3049/2733068953_76cc806b15_o.png" target="_blank" rel="lightbox"><img alt="螢幕截圖00017" hspace="hspace" src="http://farm4.static.flickr.com/3049/2733068953_eb9331a60c_t.jpg" border="0" /></a>&#160; <a title="螢幕截圖00018" href="http://farm4.static.flickr.com/3186/2733068905_e96ebb947c_o.png" target="_blank" rel="lightbox"><img alt="螢幕截圖00018" hspace="hspace" src="http://farm4.static.flickr.com/3186/2733068905_569b8d4a3d_t.jpg" border="0" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://m955.com/wp/archives/148/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>16x16 LED矩陣 小綠人專題</title>
		<link>http://m955.com/wp/archives/147</link>
		<comments>http://m955.com/wp/archives/147#comments</comments>
		<pubDate>Mon, 04 Aug 2008 15:58:31 +0000</pubDate>
		<dc:creator>blue955</dc:creator>
				<category><![CDATA[程式]]></category>
		<category><![CDATA[8051]]></category>

		<guid isPermaLink="false">http://m955.com/wp/archives/147</guid>
		<description><![CDATA[
經過了一個多月的努力，從 LAYOUT、洗電路到寫程式，小綠人專題終於完成！
請看圖吧！
&#160;&#160;&#160; 


解碼器採用 74LS154，本來一開始試用 74HC154，不過不知道我是不是買到壞的IC，不管送什... ]]></description>
			<content:encoded><![CDATA[<p></p>
<p>經過了一個多月的努力，從 LAYOUT、洗電路到寫程式，小綠人專題終於完成！</p>
<p>請看圖吧！</p>
<p><a href="http://farm4.static.flickr.com/3215/2731546132_68df493eda_o.jpg" target="_blank" rel="lightbox"><img alt="1.jpg" src="http://farm4.static.flickr.com/3215/2731546132_e43b0c0ab0_m.jpg" border="0" /></a>&#160;&#160;&#160; <a title="2.jpg" href="http://farm4.static.flickr.com/3287/2731546354_583f8e08bc_o.jpg" target="_blank" rel="lightbox"><img alt="2.jpg" src="http://farm4.static.flickr.com/3287/2731546354_83daf64c2f_m.jpg" border="0" /></a></p>
<p><span id="more-147"></span><br />
</a>
<p>解碼器採用 74LS154，本來一開始試用 74HC154，不過不知道我是不是買到壞的IC，不管送什麼訊號，解出來的位置一直都是第1或第2的位置，所以就把 74HC154 換成 74LS154 就OK了，不過腳位不一樣，所以必須要用單心線硬上。</p>
<p><img alt="74154.jpg" src="http://farm4.static.flickr.com/3209/2731546900_3eeea07669_m.jpg" border="0" /></p>
<p>底部 IC 座，原本的封裝小一點，接下來會再重洗一塊板子，會再加上 ISP 的連接，這樣一來燒錄晶片就不用一直拔來拔去了。</p>
<p><a href="http://farm3.static.flickr.com/2132/2731546708_d141380256_o.jpg" target="_blank" rel="lightbox"><img alt="4.jpg" src="http://farm3.static.flickr.com/2132/2731546708_2b2fecf847_m.jpg" border="0" /></a></p>
<p><a href="http://farm4.static.flickr.com/3017/2730714395_d01066d4c2_o.jpg" target="_blank" rel="lightbox"><img alt="3.jpg" src="http://farm4.static.flickr.com/3017/2730714395_efd1885077_m.jpg" border="0" /></a></p>
<p>電路圖參考：（<a href="http://m955.com/wp/setup/16X16LED_Anode.pdf" target="_blank">點我下載PDF LED16X16共陽</a>）</p>
<p>電路圖參考：（<a href="http://m955.com/wp/setup/16X16LED_Cathode.pdf" target="_blank">點我下載PDF LED16X16共陰</a>）</p>
<p><img alt="2008-08-05_001113.png" hspace="hspace" src="http://farm4.static.flickr.com/3049/2732549534_e43396a84c.jpg" border="0" /></p>
<p>動態展示影片：</p>
<p>
<object width="425" height="344"><param name="movie" value="http://www.youtube.com/v/vkk1vyd1WkE&#038;hl=zh_TW&#038;fs=1"></param><param name="allowFullScreen" value="true"></param><embed src="http://www.youtube.com/v/vkk1vyd1WkE&#038;hl=zh_TW&#038;fs=1" type="application/x-shockwave-flash" allowfullscreen="true" width="425" height="344"></embed></object>
</p>
<p></p>
<h2><b><font color="#FF0000">提供 LED 點矩陣程式碼，加 LED 字體碼產生器，收1000塊工本費，不過我不保證可以做的出來，因為你的電路不一定跟我一樣。需要的請寫信給我，付不出錢的，不要在留言要程式了！</b></font></h2>
<p></p>
]]></content:encoded>
			<wfw:commentRss>http://m955.com/wp/archives/147/feed</wfw:commentRss>
		<slash:comments>99</slash:comments>
		</item>
		<item>
		<title>洗PCB的一些心得</title>
		<link>http://m955.com/wp/archives/144</link>
		<comments>http://m955.com/wp/archives/144#comments</comments>
		<pubDate>Mon, 21 Jul 2008 11:26:32 +0000</pubDate>
		<dc:creator>blue955</dc:creator>
				<category><![CDATA[程式]]></category>
		<category><![CDATA[8051]]></category>

		<guid isPermaLink="false">http://m955.com/wp/archives/144</guid>
		<description><![CDATA[&#160;&#160;&#160;&#160;&#160;&#160;&#160; 最近都在洗板子，洗了半個月有了吧，成績，洗壞了四塊板子，我非電子科班出身，相關的課程也沒上過半堂，在網路上找了一些教學文章，就自己硬上了。

&#... ]]></description>
			<content:encoded><![CDATA[<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; 最近都在洗板子，洗了半個月有了吧，成績，洗壞了四塊板子，我非電子科班出身，相關的課程也沒上過半堂，在網路上找了一些教學文章，就自己硬上了。</p>
<p><span id="more-144"></span></p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; 洗PCB正統的課程會教你用「曝光法」，不過一開始嫌這方法步驟太多（多了顯影），於是乎就摒棄它，採用了網路上流傳的「熱轉印法」。</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; 所謂「熱轉印法」就是將電路採用雷射印表機印在「離型紙」（一般貼紙後面的底襯，表面光滑）上，然後再用熨斗或護貝機將離型紙的碳粉融化，進而轉印到空白電路板上，然後就可以丟到氯化鐵中蝕刻了。</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; 基本上「熱轉印法」步驟如上所述，看起來好像很簡單，其實中間會遇到的變數可真不少！</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; 首先是「離型紙」，這部分我是去買卡典西德，然後撕掉表面留下光滑面紙，這就是我們要的離型紙了，缺點：很貴！</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; 接下來你必須要有一台雷射印表機，沒有的話，我勸你就不用考慮這方法了；將電路印到離型紙上，裁好空白銅膜電路板（記得要先用砂紙磨一下，去除表面氧化部分），然後開始轉印了。</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; 轉印的方法有兩種：「護貝機或熨斗」，先來說護貝機好了，可不是任何護貝機都可以轉印的，這是我的慘痛經驗，要有兩段式加熱（180度～200度）才行，一開始我興高采烈的到網路上隨便買了一台護貝機，回家一試才知道不行，原因就是一般的護貝機溫度大概介於100度左右，溫度不夠當然無法融化碳粉，白白花了冤枉錢。</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; 接下來是熨斗，使用熨斗的優點是方便，人人家裡應該都有一台，溫度又足夠，不過缺點是，會加熱不均勻，撕起離型紙，東缺一塊，西缺一塊，還要用黑色奇異筆畫的要死。</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; 結論：「缺點：熱轉印法失敗率高，除非你先前已經失敗過好幾次，經驗充足，不然的話很難一次到位的，絕對不是像網路看到這麼容易；優點：空白電路板便宜，加熱材料隨手可得」。&#160;&#160;&#160;&#160;&#160;&#160; </p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; 請各位看倌自己看著辦吧！</p>
]]></content:encoded>
			<wfw:commentRss>http://m955.com/wp/archives/144/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>自製 AT89S51 單晶片燒錄器</title>
		<link>http://m955.com/wp/archives/142</link>
		<comments>http://m955.com/wp/archives/142#comments</comments>
		<pubDate>Thu, 26 Jun 2008 06:50:12 +0000</pubDate>
		<dc:creator>blue955</dc:creator>
				<category><![CDATA[程式]]></category>
		<category><![CDATA[8051]]></category>

		<guid isPermaLink="false">http://m955.com/wp/archives/142</guid>
		<description><![CDATA[&#160;&#160;&#160;&#160;&#160;&#160;&#160; Atmel公司所生產的AT89C51，價格便宜，內含FLASH程式記憶體，可以反覆燒錄程式，燒錄時簡單，因此在國內廣泛使用。
&#160;&#160;&#160;&#160;&#160;&#160;&#160; 目前Atmel公... ]]></description>
			<content:encoded><![CDATA[<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; Atmel公司所生產的AT89C51，價格便宜，內含FLASH程式記憶體，可以反覆燒錄程式，燒錄時簡單，因此在國內廣泛使用。</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; 目前Atmel公司又生產了改良型AT89S5X系列單晶片，AT89S5X的接腳和指令集和AT89C51完全相同，因此在程式與硬體上完全相容。</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; AT89C51在燒錄時必須在第31接腳VPP提供 +12V的電壓，而且只能夠採取並列的方式燒錄，因此使用者必須購買特殊的燒錄器，而且燒錄程式時必須將IC拔起來，放在燒錄器上，燒錄完畢後再將IC插回實驗板或麵包板。</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; 而新型的AT89S5X系列單晶片，燒錄電壓只需要 +5V，而且可以採取並列或者是串列的方式燒錄，因為使用者可以採用串列方式燒錄，因此無論是在實驗過程或是已經完成的產品，燒錄時都不需將IC拔起，使用者只需預留4支接腳（SCK、MOSI、MISO、RST）的接頭，就可以執行燒錄器記憶體的配置工作。這一種燒錄方式稱之為ISP（In System Programming）</p>
<p><span id="more-142"></span></p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; 因為AT89S5X系列單晶片可以使用 +5V的串列燒錄方式，所以使得燒錄器變的簡單，使用者可以自製一台簡易型的燒錄器，如果購買，也會比AT89C51單晶片的燒錄器便宜許多，一般AT89C51的燒錄器大約2000元左右，而AT89S5X系列單晶片燒錄器約在1000元以內。</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; Atmel公司所推出的AT89S5X系列單晶片實際上包括了：AT89S51、AT89S52、AT89S53這一些是我們一般常用的可線上燒錄的單晶片。如果你想更詳細的瞭解，你可以上Atmel的網站查詢（<a href="http://www.atmel.com/）" target="_blank">http://www.atmel.com/）</a></p>
<p>&#160;</p>
<p>1‧電路圖   <br />PDF電路圖 <a title="http://my.so-net.net.tw/windfree/89S51.pdf" href="http://my.so-net.net.tw/windfree/89S51.pdf" target="_blank">http://my.so-net.net.tw/windfree/89S51.pdf</a>（請使用鍊結另存新檔）</p>
<p><a title="電路圖.png" href="http://farm4.static.flickr.com/3225/2612858444_5163425d56_o.png" target="_blank" rel="lightbox"><img alt="電路圖.png" src="http://farm4.static.flickr.com/3225/2612858444_0b66cd3315.jpg" border="0" /></a></p>
<p>&#160;</p>
<p>2‧完成圖（正面）</p>
<p><a title="正面.jpg" href="http://farm4.static.flickr.com/3253/2612024449_4ea95ea9d2_o.jpg" target="_blank" rel="lightbox"><img alt="正面.jpg" src="http://farm4.static.flickr.com/3253/2612024449_b0fe76399e.jpg" border="0" /></a></p>
<p>&#160;</p>
<p>3‧完成圖（反面）有點醜...</p>
<p><a title="背面.JPG" href="http://farm4.static.flickr.com/3212/2612858106_e6a9968fc4_o.jpg" target="_blank" rel="lightbox"><img alt="背面.JPG" src="http://farm4.static.flickr.com/3212/2612858106_72624c0d18.jpg" border="0" /></a></p>
<p>&#160;</p>
<p>4‧連接線圖</p>
<p><a title="傳輸線.JPG" href="http://farm4.static.flickr.com/3042/2612858294_c9d9fec746_o.jpg" target="_blank" rel="lightbox"><img alt="傳輸線.JPG" src="http://farm4.static.flickr.com/3042/2612858294_98c32a3b98.jpg" border="0" /></a></p>
<p>&#160;</p>
<p>4‧（圖1）中的 D-25 接頭腳位是從前面看進去的，初學者通常會接錯（就是我），附   <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; 上實體圖對照。</p>
<p><a title="D25接頭示意圖.jpg" href="http://farm4.static.flickr.com/3286/2612024263_38a1d94ce4_o.jpg" target="_blank" rel="lightbox"><img alt="D25接頭示意圖.jpg" src="http://farm4.static.flickr.com/3286/2612024263_42c802bced.jpg" border="0" /></a></p>
<p>&#160;</p>
<p>5‧燒錄軟體下載   <br /><a href="http://www.kmitl.ac.th/~kswichit/ISP-Pgm3v0/ISP-Pgm3v0.html" target="_blank">ISP Flash Microcontroller Programmer Ver 3.0</a></p>
<p><img alt="Isp-Pgm.png" hspace="hspace" src="http://farm4.static.flickr.com/3112/2614768226_2f08b37cda.jpg" border="0" /></p>
]]></content:encoded>
			<wfw:commentRss>http://m955.com/wp/archives/142/feed</wfw:commentRss>
		<slash:comments>63</slash:comments>
		</item>
		<item>
		<title>建立資料庫連接字串的方法</title>
		<link>http://m955.com/wp/archives/123</link>
		<comments>http://m955.com/wp/archives/123#comments</comments>
		<pubDate>Tue, 20 May 2008 15:32:38 +0000</pubDate>
		<dc:creator>blue955</dc:creator>
				<category><![CDATA[程式]]></category>
		<category><![CDATA[ADO.NET]]></category>
		<category><![CDATA[VB.NET]]></category>

		<guid isPermaLink="false">http://m955.com/wp/?p=123</guid>
		<description><![CDATA[一、使用 ConnectionStringBuilder
1.連接 Access
PLAIN TEXT
VB.NET:




Dim builder As New OleDbConnectionStringBuilder


builder.Provider = "Microsoft.Jet.OLEDB.4.0"


builder.DataSource = "&#124;DataDirectory&#124;\test.mdb"


builder.Add&#40;"Jet ... ]]></description>
			<content:encoded><![CDATA[<p>一、使用 ConnectionStringBuilder<br />
1.連接 Access</p>
<div class="igBar"><span id="lvbnet-31"><a href="#" onclick="javascript:showPlainTxt('vbnet-31'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">VB.NET:</span>
<div id="vbnet-31">
<div class="vbnet">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0600FF;">Dim</span> builder <span style="color: #FF8000;">As</span> <span style="color: #FF8000;">New</span> OleDbConnectionStringBuilder</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">builder.<span style="color: #0000FF;">Provider</span> = <span style="color: #808080;">"Microsoft.Jet.OLEDB.4.0"</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">builder.<span style="color: #0000FF;">DataSource</span> = <span style="color: #808080;">"|DataDirectory|\test.mdb"</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">builder.<span style="color: #0000FF;">Add</span><span style="color: #000000;">&#40;</span><span style="color: #808080;">"Jet OLEDB:Database Password"</span>, <span style="color: #808080;">"123456"</span><span style="color: #000000;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0600FF;">Dim</span> <span style="color: #0600FF;">str</span> <span style="color: #FF8000;">As</span> <span style="color: #FF8000;">String</span> = builder.<span style="color: #0000FF;">ConnectionString</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">Return <span style="color: #0600FF;">str</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p>
<span id="more-123"></span><br />
2.連接 SQLServer</p>
<div class="igBar"><span id="lvbnet-32"><a href="#" onclick="javascript:showPlainTxt('vbnet-32'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">VB.NET:</span>
<div id="vbnet-32">
<div class="vbnet">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0600FF;">Dim</span> builder <span style="color: #FF8000;">As</span> <span style="color: #FF8000;">New</span> SqlConnectionStringBuilder</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">builder.<span style="color: #0000FF;">DataSource</span> = <span style="color: #808080;">"(local)\SQLEXPRESS"</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">builder.<span style="color: #0000FF;">InitialCatalog</span> = <span style="color: #808080;">"北風貿易"</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">builder.<span style="color: #0000FF;">IntegratedSecurity</span> = <span style="color: #0600FF;">True</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0600FF;">Dim</span> <span style="color: #0600FF;">str</span> <span style="color: #FF8000;">As</span> <span style="color: #FF8000;">String</span> = builder.<span style="color: #0000FF;">ConnectionString</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">Return <span style="color: #0600FF;">str</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>3.連接 MySql (必須安裝 <a href="http://dev.mysql.com/downloads/connector/" target="_blank">MySql.Data</a> 外掛) 請參考...</p>
<div class="igBar"><span id="lvbnet-33"><a href="#" onclick="javascript:showPlainTxt('vbnet-33'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">VB.NET:</span>
<div id="vbnet-33">
<div class="vbnet">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0600FF;">Imports</span> MySql.<span style="color: #0000FF;">Data</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0600FF;">Imports</span> MySql.<span style="color: #0000FF;">Data</span>.<span style="color: #0000FF;">MySqlClient</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #FF8000;">Public</span> <span style="color: #0600FF;">Class</span> Form1</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #FF8000;">Private</span> <span style="color: #0600FF;">Sub</span> Form1_Load<span style="color: #000000;">&#40;</span><span style="color: #FF8000;">ByVal</span> sender <span style="color: #FF8000;">As</span> System.<span style="color: #FF0000;">Object</span>, _</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #FF8000;">ByVal</span> e <span style="color: #FF8000;">As</span> System.<span style="color: #0000FF;">EventArgs</span><span style="color: #000000;">&#41;</span> <span style="color: #FF8000;">Handles</span> <span style="color: #FF8000;">MyBase</span>.<span style="color: #0000FF;">Load</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">Dim</span> builder <span style="color: #FF8000;">As</span> <span style="color: #FF8000;">New</span> MySqlConnectionStringBuilder</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; builder.<span style="color: #0000FF;">Server</span> = <span style="color: #808080;">"localhost"</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; builder.<span style="color: #0000FF;">UserID</span> = <span style="color: #808080;">"root"</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; builder.<span style="color: #0000FF;">Password</span> = <span style="color: #808080;">"123456"</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; builder.<span style="color: #0000FF;">Database</span> = <span style="color: #808080;">"test"</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">Dim</span> <span style="color: #0600FF;">str</span> <span style="color: #FF8000;">As</span> <span style="color: #FF8000;">String</span> = builder.<span style="color: #0000FF;">ConnectionString</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">Dim</span> conn <span style="color: #FF8000;">As</span> <span style="color: #FF8000;">New</span> MySqlConnection<span style="color: #000000;">&#40;</span><span style="color: #0600FF;">str</span><span style="color: #000000;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">Dim</span> commCMD <span style="color: #FF8000;">As</span> <span style="color: #FF8000;">String</span> = <span style="color: #808080;">"select * from product"</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">Dim</span> da <span style="color: #FF8000;">As</span> <span style="color: #FF8000;">New</span> MySqlDataAdapter<span style="color: #000000;">&#40;</span>commCMD, conn<span style="color: #000000;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">Dim</span> ds <span style="color: #FF8000;">As</span> <span style="color: #FF8000;">New</span> DataSet</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; conn.<span style="color: #0600FF;">Open</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; da.<span style="color: #0000FF;">Fill</span><span style="color: #000000;">&#40;</span>ds, <span style="color: #808080;">"pro"</span><span style="color: #000000;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; DataGridView1.<span style="color: #0000FF;">DataSource</span> = ds.<span style="color: #0000FF;">Tables</span><span style="color: #000000;">&#40;</span><span style="color: #808080;">"pro"</span><span style="color: #000000;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; conn.<span style="color: #0600FF;">Close</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0600FF;">End</span> <span style="color: #0600FF;">Sub</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0600FF;">End</span> <span style="color: #0600FF;">Class</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>二、使用自行撰寫連線字串，此方法容易因為人為疏失而產生錯誤<br />
1.連接 SQLServer</p>
<div class="igBar"><span id="lvbnet-34"><a href="#" onclick="javascript:showPlainTxt('vbnet-34'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">VB.NET:</span>
<div id="vbnet-34">
<div class="vbnet">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #FF8000;">Me</span>.<span style="color: #0000FF;">SqlConnection1</span>.<span style="color: #0000FF;">ConnectionString</span> = _</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080;">"Data Source=(local)\SQLEXPRESS; _</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080;">Initial Catalog=北風貿易; _</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080;">Integrated Security=True"</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
]]></content:encoded>
			<wfw:commentRss>http://m955.com/wp/archives/123/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>物件導向無痛入門(4)-屬性(Property)的概念</title>
		<link>http://m955.com/wp/archives/121</link>
		<comments>http://m955.com/wp/archives/121#comments</comments>
		<pubDate>Sun, 18 May 2008 16:27:02 +0000</pubDate>
		<dc:creator>blue955</dc:creator>
				<category><![CDATA[程式]]></category>
		<category><![CDATA[物件導向]]></category>

		<guid isPermaLink="false">http://m955.com/wp/?p=121</guid>
		<description><![CDATA[　　我們在上一篇 物件導向無痛入門(3)-基本建立類別 的正妹範例中有用到 屬性(Property) 來約束所輸入的條件值，屬性 (Property) 的使用時機是來確保 USER 所輸入的值是正確的，而避免錯誤產生... ]]></description>
			<content:encoded><![CDATA[<p>　　我們在上一篇 <a href="http://m955.com/wp/archives/120">物件導向無痛入門(3)-基本建立類別</a> 的正妹範例中有用到 屬性(Property) 來約束所輸入的條件值，屬性 (Property) 的使用時機是來確保 USER 所輸入的值是正確的，而避免錯誤產生。<br />
<span id="more-121"></span><br />
　　屬性(Property) 分為唯讀區，跟唯寫區，什麼意思呢？就是說在 GET 一區的值只可以讀出，SET 一區的值只可以寫入由於設計類別是供自己或其他程設師使用，如果輸入的值沒有加以管制的話，那麼很容易就會有錯誤產生。</p>
<p>範例1：計算發票金額<br />
　　沒有設定 屬性(Property) 時，如果使用者輸入 -100，那麼算出的金額就會變負項，這樣很容易產生錯誤</p>
<p><img src='http://farm4.static.flickr.com/3232/2501715137_6550c8f7a7_o.png' alt='' class='alignnone' /></p>
<div class="igBar"><span id="lvbnet-37"><a href="#" onclick="javascript:showPlainTxt('vbnet-37'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">VB.NET:</span>
<div id="vbnet-37">
<div class="vbnet">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #FF8000;">Public</span> <span style="color: #0600FF;">Class</span> Rat</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #008080; font-style: italic;">'計算發票的稅金</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #FF8000;">Private</span> _price <span style="color: #FF8000;">As</span> Int32</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0600FF;">Sub</span> <span style="color: #FF8000;">New</span><span style="color: #000000;">&#40;</span><span style="color: #FF8000;">ByVal</span> price <span style="color: #FF8000;">As</span> Int32<span style="color: #000000;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #FF8000;">Me</span>._price = price</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0600FF;">End</span> <span style="color: #0600FF;">Sub</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #008080; font-style: italic;">'計算稅金的方法</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0600FF;">Function</span> <span style="color: #0600FF;">rate</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">Dim</span> r <span style="color: #FF8000;">As</span> Int32 = <span style="color: #FF0000;color:#800000;">0</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; r = <span style="color: #FF8000;">Me</span>._price * <span style="color: #FF0000;color:#800000;">0</span>.<span style="color: #FF0000;color:#800000;">05</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; Return r</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0600FF;">End</span> <span style="color: #0600FF;">Function</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0600FF;">End</span> <span style="color: #0600FF;">Class</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>範例2：<br />
　　設定 屬性(Property) 時，如果使用者輸入 -100，那麼本金就會設定成 0，輸出的稅金自然也會是 0，這樣可以避免錯誤的產生</p>
<p><img src='http://farm4.static.flickr.com/3020/2502543430_9ffaefe53c_o.png' alt='' class='alignnone' /></p>
<div class="igBar"><span id="lvbnet-38"><a href="#" onclick="javascript:showPlainTxt('vbnet-38'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">VB.NET:</span>
<div id="vbnet-38">
<div class="vbnet">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #FF8000;">Public</span> <span style="color: #0600FF;">Class</span> Rat</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #008080; font-style: italic;">'計算發票的稅金</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #FF8000;">Private</span> _price <span style="color: #FF8000;">As</span> Int32</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0600FF;">Sub</span> <span style="color: #FF8000;">New</span><span style="color: #000000;">&#40;</span><span style="color: #FF8000;">ByVal</span> price <span style="color: #FF8000;">As</span> Int32<span style="color: #000000;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #FF8000;">Me</span>.<span style="color: #0000FF;">price</span> = price</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0600FF;">End</span> <span style="color: #0600FF;">Sub</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #FF8000;">Private</span> <span style="color: #FF8000;">Property</span> price<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #FF8000;">As</span> Int32</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #FF8000;">Get</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Return <span style="color: #FF8000;">Me</span>._price</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">End</span> <span style="color: #FF8000;">Get</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #FF8000;">Set</span><span style="color: #000000;">&#40;</span><span style="color: #FF8000;">ByVal</span> value <span style="color: #FF8000;">As</span> Int32<span style="color: #000000;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">If</span> value &lt;<span style="color: #FF0000;color:#800000;">0</span> <span style="color: #FF8000;">Then</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #FF8000;">Me</span>._price = <span style="color: #FF0000;color:#800000;">0</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #FF8000;">Else</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #FF8000;">Me</span>._price = value</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">End</span> <span style="color: #0600FF;">If</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">End</span> <span style="color: #FF8000;">Set</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0600FF;">End</span> <span style="color: #FF8000;">Property</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0600FF;">Function</span> <span style="color: #0600FF;">rate</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">Dim</span> r <span style="color: #FF8000;">As</span> Int32 = <span style="color: #FF0000;color:#800000;">0</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; r = <span style="color: #FF8000;">Me</span>._price * <span style="color: #FF0000;color:#800000;">0</span>.<span style="color: #FF0000;color:#800000;">05</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; Return r</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0600FF;">End</span> <span style="color: #0600FF;">Function</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0600FF;">End</span> <span style="color: #0600FF;">Class</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
]]></content:encoded>
			<wfw:commentRss>http://m955.com/wp/archives/121/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>物件導向無痛入門(3)-基本建立類別</title>
		<link>http://m955.com/wp/archives/120</link>
		<comments>http://m955.com/wp/archives/120#comments</comments>
		<pubDate>Sun, 18 May 2008 12:53:56 +0000</pubDate>
		<dc:creator>blue955</dc:creator>
				<category><![CDATA[程式]]></category>
		<category><![CDATA[物件導向]]></category>

		<guid isPermaLink="false">http://m955.com/wp/archives/120</guid>
		<description><![CDATA[&#160;&#160;&#160;&#160;&#160;&#160;&#160; 在物件導向中，類別(Class)是最基本的課程，有類別(Class)，才能產生物件(Object)，類別裡包含有：變數(Var)、屬性(Property)、方法(Method)，我知道這些名詞都很抽象... ]]></description>
			<content:encoded><![CDATA[<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; 在物件導向中，類別(Class)是最基本的課程，有類別(Class)，才能產生物件(Object)，類別裡包含有：變數(Var)、屬性(Property)、方法(Method)，我知道這些名詞都很抽象，我慢慢解釋給你聽。 </p>
<p><span id="more-120"></span></p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; 延續上一篇 物件導向無痛入門(1) 的概念，請你把物件想像成公司裡的員工，而每一個員工可以做很多事情，這就是物件；身為人事部經理的你，今天老總打電話給你，說他要應徵一個秘書，然後他開出了應徵的條件，叫你3天內馬上找到人，老總的條件如下：</p>
<ol>
<li>18～27歲的正妹</li>
<li>未婚</li>
<li>36C</li>
<li>170CM</li>
<li>配合度高</li>
</ol>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; 這裡所說的應徵條件，你就可以把他看成 <font color="#0000ff">類別(Class)</font>，然後用來產生 <font color="#0000ff">正妹秘書(物件 Object)</font>，於似乎你就上網 POST 了應徵的條件，果然不出3天就有人來應徵了，你就照著老總的條件來面試，當然面試的時候我們必須要驗證正妹的資料是否正確，而驗證正妹的規則就是可以看成 <font color="#0000ff">屬性(Property)</font>，設規則就是要保證產生的物件合乎標準！</p>
<p>讓我們把它換成程式表示吧！</p>
<p>先寫個秘書類別吧！</p>
<div class="igBar"><span id="lvbnet-41"><a href="#" onclick="javascript:showPlainTxt('vbnet-41'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">VB.NET:</span>
<div id="vbnet-41">
<div class="vbnet">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #FF8000;">Public</span> <span style="color: #0600FF;">Class</span> Secretary</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #008080; font-style: italic;">'設定變數</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #FF8000;">Private</span> _name <span style="color: #FF8000;">As</span> <span style="color: #FF8000;">String</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #FF8000;">Private</span> _age <span style="color: #FF8000;">As</span> Int32</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #FF8000;">Private</span> _ISmarry <span style="color: #FF8000;">As</span> <span style="color: #FF0000;">Boolean</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #FF8000;">Private</span> _ISc <span style="color: #FF8000;">As</span> <span style="color: #FF0000;">Boolean</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #FF8000;">Private</span> _height <span style="color: #FF8000;">As</span> Int32</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #FF8000;">Private</span> _ISmatch <span style="color: #FF8000;">As</span> <span style="color: #FF0000;">Boolean</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #FF8000;">Private</span> _score <span style="color: #FF8000;">As</span> Int32 = <span style="color: #FF0000;color:#800000;">0</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #008080; font-style: italic;">'建構子</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0600FF;">Sub</span> <span style="color: #FF8000;">New</span><span style="color: #000000;">&#40;</span><span style="color: #FF8000;">ByVal</span> name <span style="color: #FF8000;">As</span> <span style="color: #FF8000;">String</span>, <span style="color: #FF8000;">ByVal</span> age <span style="color: #FF8000;">As</span> Int32, _</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #FF8000;">ByVal</span> ISmarry <span style="color: #FF8000;">As</span> <span style="color: #FF0000;">Boolean</span>, <span style="color: #FF8000;">ByVal</span> ISc <span style="color: #FF8000;">As</span> <span style="color: #FF0000;">Boolean</span>, _</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #FF8000;">ByVal</span> height <span style="color: #FF8000;">As</span> Int32, <span style="color: #FF8000;">ByVal</span> ISmatch <span style="color: #FF8000;">As</span> <span style="color: #FF0000;">Boolean</span><span style="color: #000000;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #FF8000;">Me</span>.<span style="color: #0000FF;">name</span> = name</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #FF8000;">Me</span>.<span style="color: #0000FF;">age</span> = age</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #FF8000;">Me</span>.<span style="color: #0000FF;">ISmarry</span> = ISmarry</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #FF8000;">Me</span>.<span style="color: #0000FF;">ISc</span> = ISc</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #FF8000;">Me</span>.<span style="color: #0000FF;">height</span> = height</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #FF8000;">Me</span>.<span style="color: #0000FF;">ISmatch</span> = ISmatch</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0600FF;">End</span> <span style="color: #0600FF;">Sub</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #008080; font-style: italic;">'設定正妹名字</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #FF8000;">Property</span> name<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #FF8000;">As</span> <span style="color: #FF8000;">String</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #FF8000;">Get</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Return <span style="color: #FF8000;">Me</span>._name</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">End</span> <span style="color: #FF8000;">Get</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #FF8000;">Set</span><span style="color: #000000;">&#40;</span><span style="color: #FF8000;">ByVal</span> value <span style="color: #FF8000;">As</span> <span style="color: #FF8000;">String</span><span style="color: #000000;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #FF8000;">Me</span>._name = value</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">End</span> <span style="color: #FF8000;">Set</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0600FF;">End</span> <span style="color: #FF8000;">Property</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #008080; font-style: italic;">'驗證年齡</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #FF8000;">Property</span> age<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #FF8000;">As</span> Int32</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #FF8000;">Get</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Return <span style="color: #FF8000;">Me</span>._age</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">End</span> <span style="color: #FF8000;">Get</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #FF8000;">Set</span><span style="color: #000000;">&#40;</span><span style="color: #FF8000;">ByVal</span> value <span style="color: #FF8000;">As</span> Int32<span style="color: #000000;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">If</span> value&gt; <span style="color: #FF0000;color:#800000;">18</span> <span style="color: #804040;">And</span> value &lt;<span style="color: #FF0000;color:#800000;">27</span> <span style="color: #FF8000;">Then</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; value = <span style="color: #FF8000;">Me</span>._age</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #FF8000;">Me</span>._score += <span style="color: #FF0000;color:#800000;">1</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #FF8000;">Else</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; value = <span style="color: #FF8000;">Me</span>._age</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">End</span> <span style="color: #0600FF;">If</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">End</span> <span style="color: #FF8000;">Set</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0600FF;">End</span> <span style="color: #FF8000;">Property</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #008080; font-style: italic;">'是否結婚</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #FF8000;">Property</span> ISmarry<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #FF8000;">As</span> <span style="color: #FF0000;">Boolean</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #FF8000;">Get</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Return <span style="color: #FF8000;">Me</span>._age</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">End</span> <span style="color: #FF8000;">Get</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #FF8000;">Set</span><span style="color: #000000;">&#40;</span><span style="color: #FF8000;">ByVal</span> value <span style="color: #FF8000;">As</span> <span style="color: #FF0000;">Boolean</span><span style="color: #000000;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">If</span> value = <span style="color: #0600FF;">False</span> <span style="color: #FF8000;">Then</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; value = <span style="color: #FF8000;">Me</span>._ISmarry</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #FF8000;">Me</span>._score += <span style="color: #FF0000;color:#800000;">1</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #FF8000;">Else</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; value = <span style="color: #FF8000;">Me</span>._ISmarry</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">End</span> <span style="color: #0600FF;">If</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">End</span> <span style="color: #FF8000;">Set</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0600FF;">End</span> <span style="color: #FF8000;">Property</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #008080; font-style: italic;">'是否大於C</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #FF8000;">Property</span> ISc<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #FF8000;">As</span> <span style="color: #FF0000;">Boolean</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #FF8000;">Get</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Return <span style="color: #FF8000;">Me</span>._ISc</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">End</span> <span style="color: #FF8000;">Get</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #FF8000;">Set</span><span style="color: #000000;">&#40;</span><span style="color: #FF8000;">ByVal</span> value <span style="color: #FF8000;">As</span> <span style="color: #FF0000;">Boolean</span><span style="color: #000000;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">If</span> value = <span style="color: #0600FF;">True</span> <span style="color: #FF8000;">Then</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; value = <span style="color: #FF8000;">Me</span>._ISc</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #FF8000;">Me</span>._score += <span style="color: #FF0000;color:#800000;">1</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #FF8000;">Else</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; value = <span style="color: #FF8000;">Me</span>._ISc</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">End</span> <span style="color: #0600FF;">If</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">End</span> <span style="color: #FF8000;">Set</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0600FF;">End</span> <span style="color: #FF8000;">Property</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #008080; font-style: italic;">'驗證身高</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #FF8000;">Property</span> height<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #FF8000;">As</span> Int32</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #FF8000;">Get</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Return <span style="color: #FF8000;">Me</span>._height</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">End</span> <span style="color: #FF8000;">Get</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #FF8000;">Set</span><span style="color: #000000;">&#40;</span><span style="color: #FF8000;">ByVal</span> value <span style="color: #FF8000;">As</span> Int32<span style="color: #000000;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">If</span> value&gt; <span style="color: #FF0000;color:#800000;">170</span> <span style="color: #FF8000;">Then</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; value = <span style="color: #FF8000;">Me</span>._height</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #FF8000;">Me</span>._score += <span style="color: #FF0000;color:#800000;">1</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #FF8000;">Else</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; value = <span style="color: #FF8000;">Me</span>._height</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">End</span> <span style="color: #0600FF;">If</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">End</span> <span style="color: #FF8000;">Set</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0600FF;">End</span> <span style="color: #FF8000;">Property</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #008080; font-style: italic;">'配合高</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #FF8000;">Property</span> ISmatch<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #FF8000;">As</span> <span style="color: #FF0000;">Boolean</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #FF8000;">Get</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Return <span style="color: #FF8000;">Me</span>._ISmatch</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">End</span> <span style="color: #FF8000;">Get</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #FF8000;">Set</span><span style="color: #000000;">&#40;</span><span style="color: #FF8000;">ByVal</span> value <span style="color: #FF8000;">As</span> <span style="color: #FF0000;">Boolean</span><span style="color: #000000;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">If</span> value = <span style="color: #0600FF;">True</span> <span style="color: #FF8000;">Then</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; value = <span style="color: #FF8000;">Me</span>._ISmatch</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #FF8000;">Me</span>._score += <span style="color: #FF0000;color:#800000;">1</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #FF8000;">Else</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; value = <span style="color: #FF8000;">Me</span>._ISmatch</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">End</span> <span style="color: #0600FF;">If</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">End</span> <span style="color: #FF8000;">Set</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0600FF;">End</span> <span style="color: #FF8000;">Property</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #008080; font-style: italic;">'是否率取</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0600FF;">Sub</span> matriculate<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">If</span> <span style="color: #FF8000;">Me</span>._score&gt;= <span style="color: #FF0000;color:#800000;">5</span> <span style="color: #FF8000;">Then</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">MsgBox</span><span style="color: #000000;">&#40;</span><span style="color: #FF8000;">Me</span>._name &amp; vbCrLf &amp; _</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #808080;">"恭喜你錄取了"</span> &amp; vbCrLf &amp; _</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #808080;">"總分："</span> &amp; <span style="color: #FF8000;">Me</span>._score<span style="color: #000000;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #FF8000;">Else</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">MsgBox</span><span style="color: #000000;">&#40;</span><span style="color: #FF8000;">Me</span>._name &amp; vbCrLf &amp; _</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #808080;">"抱歉你沒錄取"</span> &amp; vbCrLf &amp; _</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #808080;">"總分："</span> &amp; <span style="color: #FF8000;">Me</span>._score<span style="color: #000000;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">End</span> <span style="color: #0600FF;">If</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0600FF;">End</span> <span style="color: #0600FF;">Sub</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0600FF;">End</span> <span style="color: #0600FF;">Class</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>在主程式裡宣告三個應徵者</p>
<div class="igBar"><span id="lvbnet-42"><a href="#" onclick="javascript:showPlainTxt('vbnet-42'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">VB.NET:</span>
<div id="vbnet-42">
<div class="vbnet">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #FF8000;">Public</span> <span style="color: #0600FF;">Class</span> Form1</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #FF8000;">Private</span> <span style="color: #0600FF;">Sub</span> Form1_Load<span style="color: #000000;">&#40;</span><span style="color: #FF8000;">ByVal</span> sender <span style="color: #FF8000;">As</span> System.<span style="color: #FF0000;">Object</span>, _</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #FF8000;">ByVal</span> e <span style="color: #FF8000;">As</span> System.<span style="color: #0000FF;">EventArgs</span><span style="color: #000000;">&#41;</span> <span style="color: #FF8000;">Handles</span> <span style="color: #FF8000;">MyBase</span>.<span style="color: #0000FF;">Load</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">Dim</span> girl1 <span style="color: #FF8000;">As</span> <span style="color: #FF8000;">New</span> Secretary<span style="color: #000000;">&#40;</span><span style="color: #808080;">"張佩君"</span>, <span style="color: #FF0000;color:#800000;">20</span>, <span style="color: #0600FF;">False</span>, <span style="color: #0600FF;">True</span>, <span style="color: #FF0000;color:#800000;">172</span>, <span style="color: #0600FF;">True</span><span style="color: #000000;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; girl1.<span style="color: #0000FF;">matriculate</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">Dim</span> girl2 <span style="color: #FF8000;">As</span> <span style="color: #FF8000;">New</span> Secretary<span style="color: #000000;">&#40;</span><span style="color: #808080;">"張秀慧"</span>, <span style="color: #FF0000;color:#800000;">28</span>, <span style="color: #0600FF;">True</span>, <span style="color: #0600FF;">True</span>, <span style="color: #FF0000;color:#800000;">165</span>, <span style="color: #0600FF;">True</span><span style="color: #000000;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; girl2.<span style="color: #0000FF;">matriculate</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">Dim</span> girl3 <span style="color: #FF8000;">As</span> <span style="color: #FF8000;">New</span> Secretary<span style="color: #000000;">&#40;</span><span style="color: #808080;">"王淑芬"</span>, <span style="color: #FF0000;color:#800000;">25</span>, <span style="color: #0600FF;">False</span>, <span style="color: #0600FF;">False</span>, <span style="color: #FF0000;color:#800000;">174</span>, <span style="color: #0600FF;">True</span><span style="color: #000000;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; girl3.<span style="color: #0000FF;">matriculate</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0600FF;">End</span> <span style="color: #0600FF;">Sub</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0600FF;">End</span> <span style="color: #0600FF;">Class</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p><img src="http://farm3.static.flickr.com/2015/2502016300_1b5521038d_o.png" /> <img src="http://farm4.static.flickr.com/3055/2501187947_7a0119bcbb_o.png" /> <img src="http://farm3.static.flickr.com/2398/2501187927_72015dfbf7_o.png" /></p>
]]></content:encoded>
			<wfw:commentRss>http://m955.com/wp/archives/120/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>物件導向無痛入門(2)-物件導向概念</title>
		<link>http://m955.com/wp/archives/163</link>
		<comments>http://m955.com/wp/archives/163#comments</comments>
		<pubDate>Sun, 18 May 2008 10:57:30 +0000</pubDate>
		<dc:creator>blue955</dc:creator>
				<category><![CDATA[程式]]></category>
		<category><![CDATA[物件導向]]></category>

		<guid isPermaLink="false">http://m955.com/wp/archives/163</guid>
		<description><![CDATA[先類別談起，首先要搞懂物件導向，必須先搞清楚，啥是類別？啥是物件？這兩個名詞懂了之後，基本的物件導向精神就懂了一大半了，類別是一個藍圖，他可以產生出物件這個東西，示意圖... ]]></description>
			<content:encoded><![CDATA[<p>先類別談起，首先要搞懂物件導向，必須先搞清楚，啥是類別？啥是物件？這兩個名詞懂了之後，基本的物件導向精神就懂了一大半了，類別是一個藍圖，他可以產生出物件這個東西，示意圖如下：</p>
<p align="center"><a href="http://farm4.static.flickr.com/3272/3018481392_037d461988_o.png" target="_blank" rel="lightbox"><img src="http://farm4.static.flickr.com/3272/3018481392_b0582e10fa.jpg" /></a></p>
<p><span id="more-163"></span></p>
<p>由上圖我們可以瞭解到，我們定義了一個正妹類別，然後可以在主程式裡以 NEW 語法宣告產生一個物件，然後設定類別中所定義的屬性(身高、體重...)，就可以產生正妹一或正妹二的物件，沒錯！就是這樣而已。</p>
<p>因為有了類別，所以我們不需要宣告很多參數，來放每個個體的參數，可以大大減少程式碼的撰寫，也可以有效的提高程式的可讀性。</p>
<p>入門之後，接下來來看看其他物件導向的名詞，與做法解釋：</p>
<p><font color="#0000ff">一、繼承(Inheritance)      <br /></font>&#160;&#160;&#160;&#160;&#160;&#160;&#160; 子類別可以繼承父類別所用有的方法和屬性，優點：節省軟體重複開發，以達到軟體再利用。</p>
<p><font color="#0000ff">二、多載(Overloading)與重寫(Overriding)      <br /></font>&#160;&#160;&#160;&#160;&#160;&#160;&#160; Overloading，「重複定義」，在同一個命名空間裡，可以同時存在多個相同名稱，但不同參數個數或是參數型態的函示。</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; Overriding，「重新定義」，指子類別，可將父類別中定義的 Method(方法) 重新定義，使得父類別的方法失效的一種技術。</p>
<p><font color="#0000ff">三、封裝(Encapsulation)      <br /></font>&#160;&#160;&#160;&#160;&#160;&#160;&#160; 將寫好的類別包成一個 .dll 檔，只提供 Method(方法)，Property(屬性)，供程式設計師使用，別人卻無法得知封裝好的 DLL 檔案內部的的程序如何撰寫，以達到資訊隱藏的特性，避免重要資訊 (演算法、資料結構...) 外流。</p>
<p><font color="#0000ff">四、資料抽象化/抽象資料型別(Data abstraction / Abstract Data Type)      <br /></font>&#160;&#160;&#160;&#160;&#160;&#160;&#160; 這是一個將物件與運算分開的資料型態，所定義出來的類別，只可以繼承，無法直接宣告。</p>
]]></content:encoded>
			<wfw:commentRss>http://m955.com/wp/archives/163/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>物件導向無痛入門(1)</title>
		<link>http://m955.com/wp/archives/118</link>
		<comments>http://m955.com/wp/archives/118#comments</comments>
		<pubDate>Sun, 18 May 2008 10:55:42 +0000</pubDate>
		<dc:creator>blue955</dc:creator>
				<category><![CDATA[程式]]></category>
		<category><![CDATA[物件導向]]></category>

		<guid isPermaLink="false">http://m955.com/wp/?p=118</guid>
		<description><![CDATA[　　近年來物件導向漸漸成為各程式語言的主流，從結構化語言→函數→物件導向，這一切的演進，其實都是符合自然的，而各種學習語言也應該如此，有人曾經說過，學習各種語言的時候，... ]]></description>
			<content:encoded><![CDATA[<p>　　近年來物件導向漸漸成為各程式語言的主流，從結構化語言→函數→物件導向，這一切的演進，其實都是符合自然的，而各種學習語言也應該如此，有人曾經說過，學習各種語言的時候，不應該一開始就從物件導向開始，我猜想他的意思也應該跟我差不多，應該循序漸進，才能收到效果。</p>
<p><span id="more-118"></span></p>
<p>　　程式剛入門時，我們學習的是基本的程式架構，從變數、型別、運算、迴圈、判斷、陣列，這以上六個課題涵蓋了所有程式本質的精神，之後才是、函式、指標。</p>
<p>　　當我們學會六個基本的課程之後，開始依照我們的想法撰寫程式，然而當我們程式越寫越多、越寫越大的同時，會發現有很多的程式碼都是重複的，當然很多人早就發現了，所以函式就產生了！</p>
<p>　　函式是把程式中重複的地方整理在一起，當我們有需要的時候再行呼叫即可，舉例說明：某一程式中需要經常運算從 N 加到 M 的值，我們就可以把規則性整理出來，寫成函式，然後等到我們需要運算時，呼叫此一函式，並將 N 和 M 的值丟入，函式就會把計算的結果回傳回來，而不用為了計算而另行撰寫程式，不僅減少了程式碼的撰寫，而且也可以減少程式的執行時間，一舉兩得！</p>
<p>　　然而當我們快樂的使用函數的同時，會發現到，一個函式只能夠處理一件事，當有很多功能時，我們就需要撰寫很多函式來解決，這似乎不是所有事件的最佳解決方案，如果一個函式可以處理很多東西那該有多好...，所以，物件導向就產生了！</p>
<p>　　把程式想像成一個部門，一個部門必須處理很多事務(Function 可以把它視為函式)，而每一個員工可以處理很多事務(打字、報告、做圖表...)，這樣的部門辦起事來是不是就很有效率，物件導向的物件就是類似以上說的員工，簡單的說，物件就是一個把變數，函式包在一起的一種技術。</p>
]]></content:encoded>
			<wfw:commentRss>http://m955.com/wp/archives/118/feed</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
	</channel>
</rss>

