<?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>Matthew Steven Kelly &#187; c#</title>
	<atom:link href="http://www.matthewstevenkelly.com/blog/tag/c/feed" rel="self" type="application/rss+xml" />
	<link>http://www.matthewstevenkelly.com/blog</link>
	<description>Just another WordPress weblog</description>
	<lastBuildDate>Sun, 05 Feb 2012 04:43:00 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Threading in C#</title>
		<link>http://www.matthewstevenkelly.com/blog/random/threading-in-c.html</link>
		<comments>http://www.matthewstevenkelly.com/blog/random/threading-in-c.html#comments</comments>
		<pubDate>Wed, 11 Feb 2009 01:12:19 +0000</pubDate>
		<dc:creator>Matthew Steven Kelly</dc:creator>
				<category><![CDATA[Random]]></category>
		<category><![CDATA[c#]]></category>

		<guid isPermaLink="false">http://www.matthewstevenkelly.com/blog/?p=437</guid>
		<description><![CDATA[A quick snippet of C# code to process data in a thread, and update a status label on the GUI to show how far along in the process it is. To use this code you just need a generic Windows &#8230; <a href="http://www.matthewstevenkelly.com/blog/random/threading-in-c.html">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>A quick snippet of C# code to process data in a thread, and update a status label on the GUI to show how far along in the process it is.</p>
<p>To use this code you just need a generic Windows Form C# application with a label control named &#8220;lblStatus&#8221; and a button control named &#8220;btnProcessData&#8221;. Additionall add a click event to the button:</p>
<p>In <b>Form1.Designer.cs</b>:</p>
<div style="width:100%;overflow:auto;background-color:#EEEEEE;">
<div>this.btnProcessData.Click&nbsp;+=&nbsp;new&nbsp;System.EventHandler(this.btnProcessData_Click);</div>
</div>
<p><b>Form1.cs</b></p>
<div style="width:100%;overflow:auto;background-color:#EEEEEE;">
<div style="width:550px;">
<div>using System;</div>
<div>using System.Threading;</div>
<div>using System.Windows.Forms;</div>
<div>using System.IO;</div>
<div></div>
<div>namespace ProcessData</div>
<div>{</div>
<div>&nbsp;&nbsp;public partial class Form1 : Form</div>
<div>&nbsp;&nbsp;{</div>
<div>&nbsp;&nbsp;&nbsp;&nbsp;private System.Threading.Thread _thread;</div>
<div>&nbsp;&nbsp;&nbsp;&nbsp;public Form1()</div>
<div>&nbsp;&nbsp;&nbsp;&nbsp;{</div>
<div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;InitializeComponent();</div>
<div>&nbsp;&nbsp;&nbsp;&nbsp;}</div>
<div></div>
<div>&nbsp;&nbsp;&nbsp;&nbsp;public delegate void UpdateLabelTextCallback(Label box, string msg);</div>
<div>&nbsp;&nbsp;&nbsp;&nbsp;/// &lt;summary&gt;</div>
<div>&nbsp;&nbsp;&nbsp;&nbsp;/// Allows threads to update text on a label</div>
<div>&nbsp;&nbsp;&nbsp;&nbsp;/// &lt;/summary&gt;</div>
<div>&nbsp;&nbsp;&nbsp;&nbsp;/// &lt;param name=&quot;lbl&quot;&gt;&lt;/param&gt;</div>
<div>&nbsp;&nbsp;&nbsp;&nbsp;/// &lt;param name=&quot;msg&quot;&gt;&lt;/param&gt;</div>
<div>&nbsp;&nbsp;&nbsp;&nbsp;private void UpdateLabelText(Label lbl, string msg)</div>
<div>&nbsp;&nbsp;&nbsp;&nbsp;{</div>
<div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;lbl.Text = msg;</div>
<div>&nbsp;&nbsp;&nbsp;&nbsp;}</div>
<div></div>
<div>&nbsp;&nbsp;&nbsp;&nbsp;/// &lt;summary&gt;</div>
<div>&nbsp;&nbsp;&nbsp;&nbsp;/// Function that processes data</div>
<div>&nbsp;&nbsp;&nbsp;&nbsp;/// &lt;/summary&gt;</div>
<div>&nbsp;&nbsp;&nbsp;&nbsp;private void btnProcessData_Click(object sender, EventArgs e)</div>
<div>&nbsp;&nbsp;&nbsp;&nbsp;{</div>
<div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;lblStatus.Invoke(new&nbsp;UpdateLabelTextCallback(this.UpdateLabelText),&nbsp;new&nbsp;object[]&nbsp;{&nbsp;lblStatus,&nbsp;string.Format(&quot;Starting&nbsp;to&nbsp;process&#8230;&quot;)&nbsp;});</div>
<div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ThreadStart TS;</div>
<div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;try</div>
<div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{</div>
<div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;TS = new ThreadStart(ProcessData);</div>
<div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;_thread = new Thread(TS);</div>
<div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;_thread.Start();</div>
<div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</div>
<div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;catch (Exception E)</div>
<div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{</div>
<div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;MessageBox.Show(string.Format(&quot;{0}&nbsp;{1}&nbsp;{2}&quot;,&nbsp;E.Message.ToString(),&nbsp;E.Source.ToString(),&nbsp;E.StackTrace.ToString()));</div>
<div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;_thread.Abort();</div>
<div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</div>
<div>&nbsp;&nbsp;&nbsp;&nbsp;}</div>
<div></div>
<div>&nbsp;&nbsp;&nbsp;&nbsp;/// &lt;summary&gt;</div>
<div>&nbsp;&nbsp;&nbsp;&nbsp;/// Function that processes data</div>
<div>&nbsp;&nbsp;&nbsp;&nbsp;/// &lt;/summary&gt;</div>
<div>&nbsp;&nbsp;&nbsp;&nbsp;private void ProcessData()</div>
<div>&nbsp;&nbsp;&nbsp;&nbsp;{</div>
<div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;int iMax = 10;</div>
<div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;for (int i=1; i&lt;=iMax; i++)</div>
<div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{</div>
<div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Thread.Sleep(500);</div>
<div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;lblStatus.Invoke(new&nbsp;UpdateLabelTextCallback(this.UpdateLabelText),&nbsp;new&nbsp;object[]&nbsp;{&nbsp;lblStatus,&nbsp;string.Format(&quot;Processing&nbsp;{0}&nbsp;or&nbsp;{1}&quot;,&nbsp;i,&nbsp;iMax)&nbsp;});</div>
<div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</div>
<div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;lblStatus.Invoke(new&nbsp;UpdateLabelTextCallback(this.UpdateLabelText),&nbsp;new&nbsp;object[]&nbsp;{&nbsp;lblStatus,&nbsp;string.Format(&quot;Finished&nbsp;processing&#8230;&quot;)&nbsp;});</div>
<div>&nbsp;&nbsp;&nbsp;&nbsp;}</div>
<div>&nbsp;&nbsp;}</div>
<div>}</div>
</div>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.matthewstevenkelly.com/blog/random/threading-in-c.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Programmatically click a C# button</title>
		<link>http://www.matthewstevenkelly.com/blog/random/programmatically-click-a-c-button.html</link>
		<comments>http://www.matthewstevenkelly.com/blog/random/programmatically-click-a-c-button.html#comments</comments>
		<pubDate>Tue, 10 Feb 2009 23:40:31 +0000</pubDate>
		<dc:creator>Matthew Steven Kelly</dc:creator>
				<category><![CDATA[Random]]></category>
		<category><![CDATA[c#]]></category>

		<guid isPermaLink="false">http://www.matthewstevenkelly.com/blog/?p=435</guid>
		<description><![CDATA[Many times I am writing a c# application where a certain function needs to be performed on a timer event as well as from a user clicking a button. So in the effort of keeping the programmatic functionality the same &#8230; <a href="http://www.matthewstevenkelly.com/blog/random/programmatically-click-a-c-button.html">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Many times I am writing a c# application where a certain function needs to be performed on a timer event as well as from a user clicking a button. So in the effort of keeping the programmatic functionality the same as the user clicked event, we can programmatically click the button:</p>
<div style="background-color:#EEEEEE;width:100%;">btnProcessData_Click(this, new EventArgs());</div>
<p>One could argue that it would be just as easy to to call a function from both locations such as ProcessData() instead of clicking the button programmatically, but the advantage is if a programmer in the future (or even you down the road) adds logic to the _Click event, it won&#8217;t be implemented in the triggered event (an event you or the new programmer may not remember or know occurs).</p>
]]></content:encoded>
			<wfw:commentRss>http://www.matthewstevenkelly.com/blog/random/programmatically-click-a-c-button.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>C Sharp Master</title>
		<link>http://www.matthewstevenkelly.com/blog/career/c-sharp-master.html</link>
		<comments>http://www.matthewstevenkelly.com/blog/career/c-sharp-master.html#comments</comments>
		<pubDate>Sat, 22 Nov 2008 20:29:15 +0000</pubDate>
		<dc:creator>Matthew Steven Kelly</dc:creator>
				<category><![CDATA[My Career]]></category>
		<category><![CDATA[c#]]></category>

		<guid isPermaLink="false">https://www.matthewstevenkelly.com/blog/?p=113</guid>
		<description><![CDATA[This weekend I became a Brain Bench certified “C# Master”. Score: 4.33. I scored higher than 96% of all previous test takers. View results: http://www.brainbench.com/transcript.jsp?pid=7948365]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.brainbench.com/transcript.jsp?pid=7948365"><img src="http://www.matthewstevenkelly.com/images/posts/csharp.gif" alt="" /></a></p>
<p>This weekend I became a Brain Bench certified “C# Master”. Score: 4.33. I scored higher than 96% of all previous test takers.</p>
<p>View results: <a href="http://www.brainbench.com/transcript.jsp?pid=7948365">http://www.brainbench.com/transcript.jsp?pid=7948365</a></p>
<p><a href="http://www.brainbench.com/transcript.jsp?pid=7948365"><img src="http://www.matthewstevenkelly.com/images/posts/brainbench_csharp.jpg" alt="" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.matthewstevenkelly.com/blog/career/c-sharp-master.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

