<?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>// do something here &#187; Visual Basic</title>
	<atom:link href="http://www.dosomethinghere.com/category/visual-basic/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.dosomethinghere.com</link>
	<description>Turning impossibilities into 1s and 0s professionally since 0&#120;07C1</description>
	<lastBuildDate>Thu, 29 Jul 2010 14:46:43 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>2010 Central Ohio Day of .NET</title>
		<link>http://www.dosomethinghere.com/2010/06/05/2010-central-ohio-day-of-net/</link>
		<comments>http://www.dosomethinghere.com/2010/06/05/2010-central-ohio-day-of-net/#comments</comments>
		<pubDate>Sat, 05 Jun 2010 23:48:56 +0000</pubDate>
		<dc:creator>BP</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[Visual Basic]]></category>
		<category><![CDATA[C#.NET]]></category>
		<category><![CDATA[CONDG]]></category>
		<category><![CDATA[VB.NET]]></category>

		<guid isPermaLink="false">http://www.dosomethinghere.com/?p=535</guid>
		<description><![CDATA[A co-w0rker and I attended the Central Ohio Day of .NET on June 5, 2010. There was quite a bit of good content at the conference, which is a real tribute to the organizers, volunteers, and presenters.
The highlights of my day were sitting in on Matt Casto&#8217;s regular expressions talk, Phil Japikse&#8217;s M-V-VM primer, discussing [...]]]></description>
			<content:encoded><![CDATA[<p>A co-w0rker and I attended the Central Ohio Day of .NET on June 5, 2010. There was quite a bit of good content at the conference, which is a real tribute to the organizers, volunteers, and presenters.</p>
<p>The highlights of my day were sitting in on Matt Casto&#8217;s regular expressions talk, Phil Japikse&#8217;s M-V-VM primer, discussing the etymology of the MongoDB project with Sam Corder (I still say it was named such after the character in Blazing Saddles), Michael Eaton&#8217;s talk on WPF, and Parag Joshi&#8217;s demonstration of XNA/Windows Phone 7 game development.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.dosomethinghere.com/2010/06/05/2010-central-ohio-day-of-net/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>VB.NET Printing For Dummies</title>
		<link>http://www.dosomethinghere.com/2010/03/16/vb-net-printing-for-dummies/</link>
		<comments>http://www.dosomethinghere.com/2010/03/16/vb-net-printing-for-dummies/#comments</comments>
		<pubDate>Wed, 17 Mar 2010 01:02:18 +0000</pubDate>
		<dc:creator>BP</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[Visual Basic]]></category>
		<category><![CDATA[VB.NET]]></category>

		<guid isPermaLink="false">http://www.dosomethinghere.com/?p=485</guid>
		<description><![CDATA[In order to send stuff to the printer in VB.NET, it is not quite as simple as dealing with the Printer object as in VB6. There are a couple of extra steps involved. Here is what I found, along with some helper methods that you might find useful.
On the form you want to print from, [...]]]></description>
			<content:encoded><![CDATA[<p>In order to send stuff to the printer in VB.NET, it is not quite as simple as dealing with the Printer object as in VB6. There are a couple of extra steps involved. Here is what I found, along with some helper methods that you might find useful.</p>
<p>On the form you want to print from, pull up the Toolbox and add a PrintDocument, a PrintDialog, and a Button, set the Document property of the PrintDialog to point to the PrintDocument you just created, and in the button&#8217;s Click event, insert the following code:</p>

<div class="wp_syntax"><div class="code"><pre class="vbnet" style="font-family:monospace;">    <span style="color: #FF8000;">Private</span> <span style="color: #0600FF;">Sub</span> butPrint_Click<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>, <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> butPrint.<span style="color: #0000FF;">Click</span>
&nbsp;
        <span style="color: #0600FF;">If</span> PrintDialog1.<span style="color: #0000FF;">ShowDialog</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #008000;">=</span> Windows.<span style="color: #0000FF;">Forms</span>.<span style="color: #0000FF;">DialogResult</span>.<span style="color: #0600FF;">OK</span> <span style="color: #FF8000;">Then</span>
            PrintDocument1.<span style="color: #0000FF;">DefaultPageSettings</span>.<span style="color: #0000FF;">Landscape</span> <span style="color: #008000;">=</span> <span style="color: #0600FF;">True</span>
            PrintDocument1.<span style="color: #FF8000;">Print</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>
        <span style="color: #0600FF;">End</span> <span style="color: #0600FF;">If</span>
&nbsp;
    <span style="color: #0600FF;">End</span> <span style="color: #0600FF;">Sub</span>
&nbsp;
    <span style="color: #FF8000;">Private</span> <span style="color: #0600FF;">Sub</span> PrintDocument1_PrintPage<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>, <span style="color: #FF8000;">ByVal</span> e <span style="color: #FF8000;">As</span> System.<span style="color: #0000FF;">Drawing</span>.<span style="color: #0000FF;">Printing</span>.<span style="color: #0000FF;">PrintPageEventArgs</span><span style="color: #000000;">&#41;</span> <span style="color: #FF8000;">Handles</span> PrintDocument1.<span style="color: #0000FF;">PrintPage</span>
&nbsp;
        PrintTestPage<span style="color: #000000;">&#40;</span>e.<span style="color: #0000FF;">Graphics</span>, PrintDocument1<span style="color: #000000;">&#41;</span>
&nbsp;
    <span style="color: #0600FF;">End</span> <span style="color: #0600FF;">Sub</span></pre></div></div>

<p>The Print method call in the button click event then fires the PrintDocument PrintPage event. Notice that I have set the default page settings to landscape. Don&#8217;t forget to wire the PrintDialog Document property to your PrintDocument, otherwise if you change the printer to print to in the print dialog, the document will still go to the default printer.</p>
<p>The PrintTestPage method is just something simple that I put together to make sure that the coordinates and justifications are all working fine. Here is that code:</p>

<div class="wp_syntax"><div class="code"><pre class="vbnet" style="font-family:monospace;">    <span style="color: #0600FF;">Sub</span> PrintTestPage<span style="color: #000000;">&#40;</span><span style="color: #FF8000;">ByVal</span> g <span style="color: #FF8000;">As</span> System.<span style="color: #0000FF;">Drawing</span>.<span style="color: #0000FF;">Graphics</span>, <span style="color: #FF8000;">ByVal</span> doc <span style="color: #FF8000;">As</span> PrintDocument<span style="color: #000000;">&#41;</span>
&nbsp;
        <span style="color: #0600FF;">Dim</span> x, y <span style="color: #FF8000;">As</span> <span style="color: #FF0000;">Integer</span>
&nbsp;
        <span style="color: #FF8000;">For</span> x <span style="color: #008000;">=</span> <span style="color: #FF0000;">0</span> <span style="color: #FF8000;">To</span> <span style="color: #FF0000;">100</span> <span style="color: #FF8000;">Step</span> <span style="color: #FF0000;">10</span>
            <span style="color: #FF8000;">For</span> y <span style="color: #008000;">=</span> <span style="color: #FF0000;">0</span> <span style="color: #FF8000;">To</span> <span style="color: #FF0000;">100</span> <span style="color: #FF8000;">Step</span> <span style="color: #FF0000;">10</span>
                PrintAtLocationWithColor<span style="color: #000000;">&#40;</span>g, doc, x.<span style="color: #0000FF;">ToString</span> <span style="color: #008000;">+</span> <span style="color: #808080;">&quot;, &quot;</span> <span style="color: #008000;">+</span> y.<span style="color: #0000FF;">ToString</span>, x, y, _
                                         <span style="color: #0600FF;">If</span><span style="color: #000000;">&#40;</span>x <span style="color: #008000;">=</span> <span style="color: #FF0000;">0</span>, <span style="color: #808080;">&quot;L&quot;</span>, <span style="color: #0600FF;">If</span><span style="color: #000000;">&#40;</span>x <span style="color: #008000;">=</span> <span style="color: #FF0000;">100</span>, <span style="color: #808080;">&quot;R&quot;</span>, <span style="color: #808080;">&quot;C&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>, <span style="color: #0600FF;">If</span><span style="color: #000000;">&#40;</span>y <span style="color: #008000;">=</span> <span style="color: #FF0000;">0</span>, <span style="color: #808080;">&quot;T&quot;</span>, <span style="color: #0600FF;">If</span><span style="color: #000000;">&#40;</span>y <span style="color: #008000;">=</span> <span style="color: #FF0000;">100</span>, <span style="color: #808080;">&quot;B&quot;</span>, <span style="color: #808080;">&quot;C&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>, _
                                         <span style="color: #808080;">&quot;Arial&quot;</span>, <span style="color: #FF0000;">8</span>, <span style="color: #0600FF;">True</span>, Brushes.<span style="color: #0600FF;">Red</span><span style="color: #000000;">&#41;</span>
            <span style="color: #FF8000;">Next</span>
        <span style="color: #FF8000;">Next</span>
&nbsp;
        PrintRectangle<span style="color: #000000;">&#40;</span>g, doc, <span style="color: #FF0000;">0</span>, <span style="color: #FF0000;">0</span>, <span style="color: #FF0000;">100</span>, <span style="color: #FF0000;">100</span><span style="color: #000000;">&#41;</span>
        PrintRectangle<span style="color: #000000;">&#40;</span>g, doc, <span style="color: #FF0000;">10</span>, <span style="color: #FF0000;">10</span>, <span style="color: #FF0000;">80</span>, <span style="color: #FF0000;">80</span><span style="color: #000000;">&#41;</span>
        PrintRectangle<span style="color: #000000;">&#40;</span>g, doc, <span style="color: #FF0000;">20</span>, <span style="color: #FF0000;">20</span>, <span style="color: #FF0000;">60</span>, <span style="color: #FF0000;">60</span><span style="color: #000000;">&#41;</span>
        PrintRectangle<span style="color: #000000;">&#40;</span>g, doc, <span style="color: #FF0000;">30</span>, <span style="color: #FF0000;">30</span>, <span style="color: #FF0000;">40</span>, <span style="color: #FF0000;">40</span><span style="color: #000000;">&#41;</span>
        PrintRectangle<span style="color: #000000;">&#40;</span>g, doc, <span style="color: #FF0000;">40</span>, <span style="color: #FF0000;">40</span>, <span style="color: #FF0000;">20</span>, <span style="color: #FF0000;">20</span><span style="color: #000000;">&#41;</span>
&nbsp;
    <span style="color: #0600FF;">End</span> <span style="color: #0600FF;">Sub</span></pre></div></div>

<p>The two methods called here, PrintAtLocationWithColor and PrintRectangle, are shown here:</p>

<div class="wp_syntax"><div class="code"><pre class="vbnet" style="font-family:monospace;">    <span style="color: #0600FF;">Sub</span> PrintAtLocationWithColor<span style="color: #000000;">&#40;</span><span style="color: #FF8000;">ByVal</span> pg <span style="color: #FF8000;">As</span> Graphics, <span style="color: #FF8000;">ByVal</span> pd <span style="color: #FF8000;">As</span> PrintDocument, <span style="color: #FF8000;">ByVal</span> s <span style="color: #FF8000;">As</span> <span style="color: #FF8000;">String</span>, _
                                <span style="color: #FF8000;">ByVal</span> xPosition <span style="color: #FF8000;">As</span> Single, <span style="color: #FF8000;">ByVal</span> yPosition <span style="color: #FF8000;">As</span> Single, _
                                <span style="color: #FF8000;">ByVal</span> justification <span style="color: #FF8000;">As</span> <span style="color: #FF8000;">String</span>, <span style="color: #FF8000;">ByVal</span> verticalJustification <span style="color: #FF8000;">As</span> <span style="color: #FF8000;">String</span>, _
                                <span style="color: #FF8000;">ByVal</span> fontFace <span style="color: #FF8000;">As</span> <span style="color: #FF8000;">String</span>, <span style="color: #FF8000;">ByVal</span> fontSize <span style="color: #FF8000;">As</span> Single, _
                                <span style="color: #FF8000;">ByVal</span> fontBold <span style="color: #FF8000;">As</span> <span style="color: #FF0000;">Boolean</span>, <span style="color: #FF8000;">ByVal</span> theColor <span style="color: #FF8000;">As</span> Brush<span style="color: #000000;">&#41;</span>
&nbsp;
        <span style="color: #0600FF;">Dim</span> w, h <span style="color: #FF8000;">As</span> Single
        <span style="color: #0600FF;">Dim</span> x, y <span style="color: #FF8000;">As</span> Single
        <span style="color: #0600FF;">Dim</span> f <span style="color: #FF8000;">As</span> Font
        <span style="color: #0600FF;">Dim</span> sty <span style="color: #FF8000;">As</span> FontStyle
&nbsp;
        sty <span style="color: #008000;">=</span> FontStyle.<span style="color: #0000FF;">Regular</span>
        <span style="color: #0600FF;">If</span> fontBold <span style="color: #FF8000;">Then</span> sty <span style="color: #008000;">=</span> sty <span style="color: #008000;">+</span> FontStyle.<span style="color: #0000FF;">Bold</span>
        <span style="color: #0600FF;">If</span> fontSize &lt; <span style="color: #FF0000;">1</span> <span style="color: #FF8000;">Then</span> fontSize <span style="color: #008000;">=</span> <span style="color: #FF0000;">8.0</span>
        f <span style="color: #008000;">=</span> <span style="color: #FF8000;">New</span> Font<span style="color: #000000;">&#40;</span>fontFace, fontSize, sty<span style="color: #000000;">&#41;</span>
&nbsp;
        <span style="color: #0600FF;">If</span> pd.<span style="color: #0000FF;">DefaultPageSettings</span>.<span style="color: #0000FF;">Landscape</span> <span style="color: #FF8000;">Then</span>
            x <span style="color: #008000;">=</span> xPosition <span style="color: #008000;">/</span> <span style="color: #FF0000;">100</span> <span style="color: #008000;">*</span> <span style="color: #000000;">&#40;</span>pd.<span style="color: #0000FF;">DefaultPageSettings</span>.<span style="color: #0000FF;">PrintableArea</span>.<span style="color: #0000FF;">Height</span><span style="color: #000000;">&#41;</span>
            y <span style="color: #008000;">=</span> yPosition <span style="color: #008000;">/</span> <span style="color: #FF0000;">100</span> <span style="color: #008000;">*</span> <span style="color: #000000;">&#40;</span>pd.<span style="color: #0000FF;">DefaultPageSettings</span>.<span style="color: #0000FF;">PrintableArea</span>.<span style="color: #0600FF;">Width</span><span style="color: #000000;">&#41;</span>
        <span style="color: #FF8000;">Else</span>
            x <span style="color: #008000;">=</span> xPosition <span style="color: #008000;">/</span> <span style="color: #FF0000;">100</span> <span style="color: #008000;">*</span> <span style="color: #000000;">&#40;</span>pd.<span style="color: #0000FF;">DefaultPageSettings</span>.<span style="color: #0000FF;">PrintableArea</span>.<span style="color: #0600FF;">Width</span><span style="color: #000000;">&#41;</span>
            y <span style="color: #008000;">=</span> yPosition <span style="color: #008000;">/</span> <span style="color: #FF0000;">100</span> <span style="color: #008000;">*</span> <span style="color: #000000;">&#40;</span>pd.<span style="color: #0000FF;">DefaultPageSettings</span>.<span style="color: #0000FF;">PrintableArea</span>.<span style="color: #0000FF;">Height</span><span style="color: #000000;">&#41;</span>
        <span style="color: #0600FF;">End</span> <span style="color: #0600FF;">If</span>
&nbsp;
        w <span style="color: #008000;">=</span> pg.<span style="color: #0000FF;">MeasureString</span><span style="color: #000000;">&#40;</span>s, f<span style="color: #000000;">&#41;</span>.<span style="color: #0600FF;">Width</span>
        h <span style="color: #008000;">=</span> pg.<span style="color: #0000FF;">MeasureString</span><span style="color: #000000;">&#40;</span>s, f<span style="color: #000000;">&#41;</span>.<span style="color: #0000FF;">Height</span>
&nbsp;
        <span style="color: #0600FF;">If</span> <span style="color: #0600FF;">Left</span><span style="color: #000000;">&#40;</span><span style="color: #0600FF;">UCase</span><span style="color: #000000;">&#40;</span>justification<span style="color: #000000;">&#41;</span>, <span style="color: #FF0000;">1</span><span style="color: #000000;">&#41;</span> <span style="color: #008000;">=</span> <span style="color: #808080;">&quot;C&quot;</span> <span style="color: #FF8000;">Then</span>
            x <span style="color: #008000;">=</span> x <span style="color: #008000;">-</span> w <span style="color: #008000;">/</span> <span style="color: #FF0000;">2</span>
        <span style="color: #0600FF;">End</span> <span style="color: #0600FF;">If</span>
        <span style="color: #0600FF;">If</span> <span style="color: #0600FF;">Left</span><span style="color: #000000;">&#40;</span><span style="color: #0600FF;">UCase</span><span style="color: #000000;">&#40;</span>justification<span style="color: #000000;">&#41;</span>, <span style="color: #FF0000;">1</span><span style="color: #000000;">&#41;</span> <span style="color: #008000;">=</span> <span style="color: #808080;">&quot;R&quot;</span> <span style="color: #FF8000;">Then</span>
            x <span style="color: #008000;">=</span> x <span style="color: #008000;">-</span> w
        <span style="color: #0600FF;">End</span> <span style="color: #0600FF;">If</span>
&nbsp;
        <span style="color: #0600FF;">If</span> <span style="color: #0600FF;">Left</span><span style="color: #000000;">&#40;</span><span style="color: #0600FF;">UCase</span><span style="color: #000000;">&#40;</span>verticalJustification<span style="color: #000000;">&#41;</span>, <span style="color: #FF0000;">1</span><span style="color: #000000;">&#41;</span> <span style="color: #008000;">=</span> <span style="color: #808080;">&quot;C&quot;</span> <span style="color: #FF8000;">Then</span>
            y <span style="color: #008000;">=</span> y <span style="color: #008000;">-</span> h <span style="color: #008000;">/</span> <span style="color: #FF0000;">2</span>
        <span style="color: #0600FF;">End</span> <span style="color: #0600FF;">If</span>
        <span style="color: #0600FF;">If</span> <span style="color: #0600FF;">Left</span><span style="color: #000000;">&#40;</span><span style="color: #0600FF;">UCase</span><span style="color: #000000;">&#40;</span>verticalJustification<span style="color: #000000;">&#41;</span>, <span style="color: #FF0000;">1</span><span style="color: #000000;">&#41;</span> <span style="color: #008000;">=</span> <span style="color: #808080;">&quot;B&quot;</span> <span style="color: #FF8000;">Then</span>
            y <span style="color: #008000;">=</span> y <span style="color: #008000;">-</span> h
        <span style="color: #0600FF;">End</span> <span style="color: #0600FF;">If</span>
&nbsp;
        pg.<span style="color: #0000FF;">DrawString</span><span style="color: #000000;">&#40;</span>s, f, theColor, x, y<span style="color: #000000;">&#41;</span>
&nbsp;
    <span style="color: #0600FF;">End</span> <span style="color: #0600FF;">Sub</span>
&nbsp;
    <span style="color: #0600FF;">Sub</span> PrintRectangle<span style="color: #000000;">&#40;</span><span style="color: #FF8000;">ByVal</span> pg <span style="color: #FF8000;">As</span> Graphics, <span style="color: #FF8000;">ByVal</span> pd <span style="color: #FF8000;">As</span> PrintDocument, <span style="color: #FF8000;">ByVal</span> xPosition <span style="color: #FF8000;">As</span> Single, <span style="color: #FF8000;">ByVal</span> yPosition <span style="color: #FF8000;">As</span> Single, _
                                <span style="color: #FF8000;">ByVal</span> <span style="color: #0600FF;">width</span> <span style="color: #FF8000;">As</span> Single, <span style="color: #FF8000;">ByVal</span> height <span style="color: #FF8000;">As</span> Single<span style="color: #000000;">&#41;</span>
&nbsp;
        <span style="color: #0600FF;">Dim</span> w, h <span style="color: #FF8000;">As</span> Single
        <span style="color: #0600FF;">Dim</span> x, y <span style="color: #FF8000;">As</span> Single
&nbsp;
        <span style="color: #0600FF;">If</span> pd.<span style="color: #0000FF;">DefaultPageSettings</span>.<span style="color: #0000FF;">Landscape</span> <span style="color: #FF8000;">Then</span>
            x <span style="color: #008000;">=</span> xPosition <span style="color: #008000;">/</span> <span style="color: #FF0000;">100</span> <span style="color: #008000;">*</span> <span style="color: #000000;">&#40;</span>pd.<span style="color: #0000FF;">DefaultPageSettings</span>.<span style="color: #0000FF;">PrintableArea</span>.<span style="color: #0000FF;">Height</span><span style="color: #000000;">&#41;</span>
            y <span style="color: #008000;">=</span> yPosition <span style="color: #008000;">/</span> <span style="color: #FF0000;">100</span> <span style="color: #008000;">*</span> <span style="color: #000000;">&#40;</span>pd.<span style="color: #0000FF;">DefaultPageSettings</span>.<span style="color: #0000FF;">PrintableArea</span>.<span style="color: #0600FF;">Width</span><span style="color: #000000;">&#41;</span>
            w <span style="color: #008000;">=</span> <span style="color: #0600FF;">width</span> <span style="color: #008000;">/</span> <span style="color: #FF0000;">100</span> <span style="color: #008000;">*</span> <span style="color: #000000;">&#40;</span>pd.<span style="color: #0000FF;">DefaultPageSettings</span>.<span style="color: #0000FF;">PrintableArea</span>.<span style="color: #0000FF;">Height</span><span style="color: #000000;">&#41;</span>
            h <span style="color: #008000;">=</span> height <span style="color: #008000;">/</span> <span style="color: #FF0000;">100</span> <span style="color: #008000;">*</span> <span style="color: #000000;">&#40;</span>pd.<span style="color: #0000FF;">DefaultPageSettings</span>.<span style="color: #0000FF;">PrintableArea</span>.<span style="color: #0600FF;">Width</span><span style="color: #000000;">&#41;</span>
        <span style="color: #FF8000;">Else</span>
            x <span style="color: #008000;">=</span> xPosition <span style="color: #008000;">/</span> <span style="color: #FF0000;">100</span> <span style="color: #008000;">*</span> <span style="color: #000000;">&#40;</span>pd.<span style="color: #0000FF;">DefaultPageSettings</span>.<span style="color: #0000FF;">PrintableArea</span>.<span style="color: #0600FF;">Width</span><span style="color: #000000;">&#41;</span>
            y <span style="color: #008000;">=</span> yPosition <span style="color: #008000;">/</span> <span style="color: #FF0000;">100</span> <span style="color: #008000;">*</span> <span style="color: #000000;">&#40;</span>pd.<span style="color: #0000FF;">DefaultPageSettings</span>.<span style="color: #0000FF;">PrintableArea</span>.<span style="color: #0000FF;">Height</span><span style="color: #000000;">&#41;</span>
            w <span style="color: #008000;">=</span> <span style="color: #0600FF;">width</span> <span style="color: #008000;">/</span> <span style="color: #FF0000;">100</span> <span style="color: #008000;">*</span> <span style="color: #000000;">&#40;</span>pd.<span style="color: #0000FF;">DefaultPageSettings</span>.<span style="color: #0000FF;">PrintableArea</span>.<span style="color: #0600FF;">Width</span><span style="color: #000000;">&#41;</span>
            h <span style="color: #008000;">=</span> height <span style="color: #008000;">/</span> <span style="color: #FF0000;">100</span> <span style="color: #008000;">*</span> <span style="color: #000000;">&#40;</span>pd.<span style="color: #0000FF;">DefaultPageSettings</span>.<span style="color: #0000FF;">PrintableArea</span>.<span style="color: #0000FF;">Height</span><span style="color: #000000;">&#41;</span>
        <span style="color: #0600FF;">End</span> <span style="color: #0600FF;">If</span>
&nbsp;
        pg.<span style="color: #0000FF;">DrawRectangle</span><span style="color: #000000;">&#40;</span>Pens.<span style="color: #0600FF;">Black</span>, x, y, w, h<span style="color: #000000;">&#41;</span>
&nbsp;
    <span style="color: #0600FF;">End</span> <span style="color: #0600FF;">Sub</span></pre></div></div>

<p>All of the positioning and size parameters of these methods are percentages across and down the page, which I find much easier to deal with than absolute or printer specific positioning. This makes it dead simple to scale the reports to any page size I want to use.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.dosomethinghere.com/2010/03/16/vb-net-printing-for-dummies/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>.NET Kombat (Format vs. ToString)</title>
		<link>http://www.dosomethinghere.com/2010/02/23/net-kombat-format-vs-tostring/</link>
		<comments>http://www.dosomethinghere.com/2010/02/23/net-kombat-format-vs-tostring/#comments</comments>
		<pubDate>Wed, 24 Feb 2010 03:43:51 +0000</pubDate>
		<dc:creator>BP</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[Visual Basic]]></category>
		<category><![CDATA[VB.NET]]></category>

		<guid isPermaLink="false">http://www.dosomethinghere.com/?p=468</guid>
		<description><![CDATA[In converting some legacy VB6 code to VB.NET, I noticed that there was a lot of use of the Format function in the code to convert numbers to strings. This makes sense as Format was pretty much the only game in town in VB6.
However, in .NET, they introduced a handy-dandy .ToString() method that, on the [...]]]></description>
			<content:encoded><![CDATA[<p>In converting some legacy VB6 code to VB.NET, I noticed that there was a lot of use of the Format function in the code to convert numbers to strings. This makes sense as Format was pretty much the only game in town in VB6.</p>
<p>However, in .NET, they introduced a handy-dandy .ToString() method that, on the surface, seems to do much the same thing as the Format function. I have been able to use them pretty much interchangeably with the desired results coming out every time.</p>
<p>I started to wonder which way was faster. Since I am a big proponent of empirical knowledge instead of just trying to get the theoretical story behind the two ways to do this, I rolled together this quick VB.NET console application:</p>

<div class="wp_syntax"><div class="code"><pre class="vb" style="font-family:monospace;">Imports System.Text
&nbsp;
Module Module1
&nbsp;
    <span style="color: #000080;">Sub</span> Main()
&nbsp;
        <span style="color: #000080;">Dim</span> i <span style="color: #000080;">As</span> <span style="color: #000080;">Integer</span>
        <span style="color: #000080;">Dim</span> r <span style="color: #000080;">As</span> <span style="color: #000080;">Random</span> = <span style="color: #000080;">New</span> <span style="color: #000080;">Random</span>()
        <span style="color: #000080;">Dim</span> t <span style="color: #000080;">As</span> <span style="color: #000080;">Double</span>
&nbsp;
        System.Console.WriteLine(<span style="color: #800000;">&quot;10,000,000 Formats&quot;</span>)
        <span style="color: #000080;">Dim</span> sb1 <span style="color: #000080;">As</span> <span style="color: #000080;">New</span> stringbuilder
        t = Timer
        <span style="color: #000080;">For</span> i = 1 <span style="color: #000080;">To</span> 10000000
            sb1.<span style="color: #000080;">Append</span>(Format(r.NextDouble * 100.0, <span style="color: #800000;">&quot;###0.00 &quot;</span>))
        <span style="color: #000080;">Next</span>
        System.Console.WriteLine(<span style="color: #800000;">&quot;Seconds elapsed: &quot;</span> + (Timer - t).ToString(<span style="color: #800000;">&quot;#######0.00&quot;</span>))
        System.Console.WriteLine(<span style="color: #800000;">&quot;Length of string builder: &quot;</span> + sb1.Length.ToString())
        System.Console.WriteLine()
&nbsp;
        System.Console.WriteLine(<span style="color: #800000;">&quot;10,000,000 ToStrings&quot;</span>)
        <span style="color: #000080;">Dim</span> sb2 <span style="color: #000080;">As</span> <span style="color: #000080;">New</span> StringBuilder
        t = Timer
        <span style="color: #000080;">For</span> i = 1 <span style="color: #000080;">To</span> 10000000
            sb2.<span style="color: #000080;">Append</span>((r.NextDouble * 100.0).ToString(<span style="color: #800000;">&quot;###0.00 &quot;</span>))
        <span style="color: #000080;">Next</span>
        System.Console.WriteLine(<span style="color: #800000;">&quot;Seconds elapsed: &quot;</span> + (Timer - t).ToString(<span style="color: #800000;">&quot;#######0.00&quot;</span>))
        System.Console.WriteLine(<span style="color: #800000;">&quot;Length of string builder: &quot;</span> + sb2.Length.ToString())
        System.Console.WriteLine()
&nbsp;
        System.Console.WriteLine(<span style="color: #800000;">&quot;Press any key to end the program &quot;</span>)
        System.Console.ReadKey()
&nbsp;
    <span style="color: #000080;">End</span> <span style="color: #000080;">Sub</span>
&nbsp;
<span style="color: #000080;">End</span> Module</pre></div></div>

<p>And here are the results:</p>
<p><a href="http://www.dosomethinghere.com/wp-content/uploads/2010/02/FormatVsToString.png"><img class="alignnone size-full wp-image-469" title="FormatVsToString" src="http://www.dosomethinghere.com/wp-content/uploads/2010/02/FormatVsToString.png" alt="" width="668" height="331" /></a></p>
<p>As you can see, the ToString method is about 15% faster when doing 10 million calls with random numbers.</p>
<p>Oh, and by the way, Happy <a href="http://www.ihoppancakeday.com/" target="_blank">Pancake Day</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.dosomethinghere.com/2010/02/23/net-kombat-format-vs-tostring/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Easy way to format the time difference between two dates</title>
		<link>http://www.dosomethinghere.com/2010/01/27/easy-way-to-format-the-time-difference-between-two-dates/</link>
		<comments>http://www.dosomethinghere.com/2010/01/27/easy-way-to-format-the-time-difference-between-two-dates/#comments</comments>
		<pubDate>Wed, 27 Jan 2010 18:56:36 +0000</pubDate>
		<dc:creator>BP</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[Visual Basic]]></category>
		<category><![CDATA[VB]]></category>
		<category><![CDATA[VB.NET]]></category>

		<guid isPermaLink="false">http://www.dosomethinghere.com/?p=457</guid>
		<description><![CDATA[In converting my VB6 code over to VB.NET, I was looking for an easy way to take the different between two DateTime items and display in hours and minutes.  The TimeSpan gives a nice structure to dive into the difference and see exactly the interval, but I was hoping to find a way to output [...]]]></description>
			<content:encoded><![CDATA[<p>In converting my VB6 code over to VB.NET, I was looking for an easy way to take the different between two DateTime items and display in hours and minutes.  The TimeSpan gives a nice structure to dive into the difference and see exactly the interval, but I was hoping to find a way to output this in the same way that you can use the ToShortTimeString method of DateTime.</p>
<p>As it turns out, I found a posting by Jay Barlow that mentions converting the time different to a date time, and then using a custom format string to do the work so that I wouldn&#8217;t have to.  Here is my new VB.NET code, where rec is a class that includes the start and end date and duration is a string that holds the information to be displayed:</p>

<div class="wp_syntax"><div class="code"><pre class="vb" style="font-family:monospace;"><span style="color: #000080;">If</span> rec.endDate IsNot <span style="color: #000080;">Nothing</span> <span style="color: #000080;">Then</span>
    <span style="color: #000080;">Dim</span> ts <span style="color: #000080;">As</span> TimeSpan = <span style="color: #000080;">CDate</span>(rec.endDate).Subtract(rec.startDate)
    <span style="color: #000080;">Dim</span> dt <span style="color: #000080;">As</span> DateTime = DateTime.MinValue.Add(ts)
    duration = <span style="color: #800000;">&quot;Event duration: &quot;</span> + dt.ToString(<span style="color: #800000;">&quot;H:mm&quot;</span>)
<span style="color: #000080;">End</span> <span style="color: #000080;">If</span></pre></div></div>

<p>Oh, and one more thing.  Am I the only one in the world that thinks that iPad is the worst product name in history? Sure, it is so close to iPod so as to create brand recognition and draw comparisons, but I would just wonder what kind of names were shot down, and if any of them did not begin with the letter i.</p>
<p>By the way, Happy (Belated) Australia Day.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.dosomethinghere.com/2010/01/27/easy-way-to-format-the-time-difference-between-two-dates/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>VB.NET radio button groups act differently than VB6 radio button groups</title>
		<link>http://www.dosomethinghere.com/2010/01/08/vb-net-radio-button-groups-act-differently-than-vb6-radio-button-groups/</link>
		<comments>http://www.dosomethinghere.com/2010/01/08/vb-net-radio-button-groups-act-differently-than-vb6-radio-button-groups/#comments</comments>
		<pubDate>Sat, 09 Jan 2010 03:18:42 +0000</pubDate>
		<dc:creator>BP</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[Visual Basic]]></category>
		<category><![CDATA[VB]]></category>
		<category><![CDATA[VB.NET]]></category>

		<guid isPermaLink="false">http://www.dosomethinghere.com/?p=452</guid>
		<description><![CDATA[The few dozen remaining WinForms developers left on this planet may have noticed that, for some reason, a group box with radio buttons in it as designed in the Visual Studio 2008 environment will have the first radio button of the first group box automatically selected when the form comes up, even though all of [...]]]></description>
			<content:encoded><![CDATA[<p>The few dozen remaining WinForms developers left on this planet may have noticed that, for some reason, a group box with radio buttons in it as designed in the Visual Studio 2008 environment will have the first radio button of the first group box automatically selected when the form comes up, even though all of the radio buttons have their Checked property set to false in the design environment.  It never used to do this in VB6, as when you ran the application, the group of radio buttons would have no members selected.</p>
<p>The problem manifests itself when you are trying to perform additional tasks in the CheckedChanged event of the radio buttons when the user selects one of the radio buttons, since the first radio button is being automatically selected.</p>
<p>I asked this question on Stack Overflow, and got a couple of replies. The one that I finally used to solve the problem was to set the Checked property of the radio buttons to false in the form&#8217;s Shown event, which I had never used before. By doing this, the first radio button was no longer automatically showing up checked.</p>
<p>One other thing that I had to do in addition was to cast the sender into a RadioButton and look at the Checked property of the clicked radio button in the CheckedChanged event, as that event is fired for radio buttons both being turned on and also turned off.</p>
<p>Oh, and happy National English Toffee Day!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.dosomethinghere.com/2010/01/08/vb-net-radio-button-groups-act-differently-than-vb6-radio-button-groups/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Control arrays in VB.NET</title>
		<link>http://www.dosomethinghere.com/2009/12/28/control-arrays-in-vb-net/</link>
		<comments>http://www.dosomethinghere.com/2009/12/28/control-arrays-in-vb-net/#comments</comments>
		<pubDate>Tue, 29 Dec 2009 00:57:54 +0000</pubDate>
		<dc:creator>BP</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[Visual Basic]]></category>
		<category><![CDATA[VB.NET]]></category>

		<guid isPermaLink="false">http://www.dosomethinghere.com/?p=443</guid>
		<description><![CDATA[One of the things that I really liked (and used quite a bit) in the VB6 IDE was the ability to use the design surface to create a form with a bunch of controls with the same name as a control array. You would create the controls on the design page, give it the same [...]]]></description>
			<content:encoded><![CDATA[<p>One of the things that I really liked (and used quite a bit) in the VB6 IDE was the ability to use the design surface to create a form with a bunch of controls with the same name as a control array. You would create the controls on the design page, give it the same name as another control, and the Index property would automatically be incremented. This would then let me use a loop to manipulate and examine these controls.</p>
<p>This functionality is missing in VB.NET, as I discovered when I tried to do my first .NET Compact Framework application way back when Visual Studio 2003 was shiny and new, and has continued to be missing from the feature set in VS2005 and VS2008.</p>
<p>Microsoft is not much help on this front. Their solution is to create the forms in code, as described in this article:</p>
<p><a href="http://msdn.microsoft.com/en-us/library/aa289500(VS.71).aspx" target="_blank">Not so helpful link</a></p>
<p>But I like using the design surface to create forms. A co-worker suggested we try to do a test in C# and tamper with the designer.cs file to create an array of controls in there, which worked OK. The big problems there were that the controls showed up on the design surface, but they could not be clicked and modified. Also, when we added a control to the form and saved it, all of the customizations we made to the designer file disappeared. (Oops.)</p>
<p>So instead, what I am now doing is creating my forms in the designer as before, with each control of the set having a different name with a number after it (such as cboName0, cboName1, etc.), referring to the index of the control in the array. At the top of the form&#8217;s class I have the arrays defined:</p>

<div class="wp_syntax"><div class="code"><pre class="vbnet" style="font-family:monospace;"><span style="color: #0600FF;">Dim</span> cboName<span style="color: #000000;">&#40;</span><span style="color: #FF0000;">10</span><span style="color: #000000;">&#41;</span> <span style="color: #FF8000;">as</span> ComboBox
<span style="color: #0600FF;">Dim</span> lblNumber<span style="color: #000000;">&#40;</span><span style="color: #FF0000;">10</span><span style="color: #000000;">&#41;</span> <span style="color: #FF8000;">as</span> Label</pre></div></div>

<p>Then, in the form load event, I am calling this subroutine:</p>

<div class="wp_syntax"><div class="code"><pre class="vbnet" style="font-family:monospace;"><span style="color: #0600FF;">Sub</span> SetUpControlArrays<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>
&nbsp;
    <span style="color: #FF8000;">For</span> <span style="color: #0600FF;">Each</span> cb In <span style="color: #FF8000;">Me</span>.<span style="color: #0000FF;">Controls</span>.<span style="color: #0000FF;">OfType</span><span style="color: #000000;">&#40;</span>Of ComboBox<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>
        <span style="color: #0600FF;">If</span> cb.<span style="color: #0000FF;">Name</span>.<span style="color: #0000FF;">Contains</span><span style="color: #000000;">&#40;</span><span style="color: #808080;">&quot;cboName&quot;</span><span style="color: #000000;">&#41;</span> <span style="color: #FF8000;">Then</span>
            cboName<span style="color: #000000;">&#40;</span><span style="color: #0600FF;">CInt</span><span style="color: #000000;">&#40;</span>cb.<span style="color: #0000FF;">Name</span>.<span style="color: #0600FF;">Replace</span><span style="color: #000000;">&#40;</span><span style="color: #808080;">&quot;cboName&quot;</span>, <span style="color: #808080;">&quot;&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span> <span style="color: #008000;">=</span> cb
        <span style="color: #0600FF;">End</span> <span style="color: #0600FF;">If</span>
    <span style="color: #FF8000;">Next</span>
&nbsp;
    <span style="color: #FF8000;">For</span> <span style="color: #0600FF;">Each</span> lbl In <span style="color: #FF8000;">Me</span>.<span style="color: #0000FF;">Controls</span>.<span style="color: #0000FF;">OfType</span><span style="color: #000000;">&#40;</span>Of Label<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>
        <span style="color: #0600FF;">If</span> lbl.<span style="color: #0000FF;">Name</span>.<span style="color: #0000FF;">Contains</span><span style="color: #000000;">&#40;</span><span style="color: #808080;">&quot;lblNumber&quot;</span><span style="color: #000000;">&#41;</span> <span style="color: #FF8000;">Then</span>
            lblNumber<span style="color: #000000;">&#40;</span><span style="color: #0600FF;">CInt</span><span style="color: #000000;">&#40;</span>lbl.<span style="color: #0000FF;">Name</span>.<span style="color: #0600FF;">Replace</span><span style="color: #000000;">&#40;</span><span style="color: #808080;">&quot;lblNumber&quot;</span>, <span style="color: #808080;">&quot;&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span> <span style="color: #008000;">=</span> lbl
        <span style="color: #0600FF;">End</span> <span style="color: #0600FF;">If</span>
    <span style="color: #FF8000;">Next</span>
&nbsp;
<span style="color: #0600FF;">End</span> <span style="color: #0600FF;">Sub</span></pre></div></div>

<p>Now I have the ability to address the controls in the same way that I used to do in VB6. The fact that I lived with this missing feature for about 6 years and just now figuring out a decent way around the problem pretty much guarantees that VS2010 will put the control arrays back in.</p>
<p><strong>EDIT:</strong> At the request of a Strong Bad fan who shall remain nameless, I changed up the code above to be a bit more friendly. The previous code only extracted the rightmost 1 character from the name of the control on the design surface, which would not work if you had a control name such as cboName10.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.dosomethinghere.com/2009/12/28/control-arrays-in-vb-net/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>How to get the version number of a running process</title>
		<link>http://www.dosomethinghere.com/2009/11/24/how-to-get-the-version-number-of-a-running-process/</link>
		<comments>http://www.dosomethinghere.com/2009/11/24/how-to-get-the-version-number-of-a-running-process/#comments</comments>
		<pubDate>Wed, 25 Nov 2009 01:37:47 +0000</pubDate>
		<dc:creator>BP</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[Visual Basic]]></category>
		<category><![CDATA[VB.NET]]></category>

		<guid isPermaLink="false">http://www.dosomethinghere.com/?p=396</guid>
		<description><![CDATA[I wanted to have my .NET based Palm OS conduit DLL be able to report the version of the HotSync Manager that the user has installed on their computer. Initially, I was going to try to read the version of the executable, but then I would first have to find the path to the executable, [...]]]></description>
			<content:encoded><![CDATA[<p>I wanted to have my .NET based Palm OS conduit DLL be able to report the version of the HotSync Manager that the user has installed on their computer. Initially, I was going to try to read the version of the executable, but then I would first have to find the path to the executable, and hope that this would be a reliable enough method.</p>
<p>As it turns out, after I did a little investigation, I found out that it is not necessary to try and figure out where the HotSync Manager is installed by reading the appropriate registry key to get the HotSync Manager location and then trying to get the version number of the assembly at that path. Because the user is in the conduit code, the HotSync Manager (HOTSYNC.EXE) is already in the running processes list. It just so happens that in the System.Diagnostics namespace there is a handy dandy method that gets all of the running processes, along with a goodly amount of information about each process, including the version number.</p>
<p>So here is my VB.NET code that searches for the HotSync Manager process and returns the version number as a string.</p>

<div class="wp_syntax"><div class="code"><pre class="vbnet" style="font-family:monospace;"><span style="color: #0600FF;">Function</span> GetHotSyncVersion<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #FF8000;">As</span> <span style="color: #FF8000;">String</span>
&nbsp;
    <span style="color: #0600FF;">Dim</span> versionString <span style="color: #FF8000;">As</span> <span style="color: #FF8000;">String</span> <span style="color: #008000;">=</span> <span style="color: #808080;">&quot;Unknown&quot;</span>
&nbsp;
    <span style="color: #0600FF;">Dim</span> procList <span style="color: #FF8000;">As</span> List<span style="color: #000000;">&#40;</span>Of Process<span style="color: #000000;">&#41;</span> <span style="color: #008000;">=</span> Process.<span style="color: #0000FF;">GetProcesses</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>.<span style="color: #0000FF;">ToList</span>
    <span style="color: #0600FF;">Dim</span> hotSyncProcess <span style="color: #FF8000;">As</span> Process <span style="color: #008000;">=</span> <span style="color: #FF8000;">Nothing</span>
    <span style="color: #FF8000;">For</span> <span style="color: #0600FF;">Each</span> p In procList
        <span style="color: #0600FF;">If</span> p.<span style="color: #0000FF;">ProcessName</span>.<span style="color: #0000FF;">ToUpper</span> <span style="color: #008000;">=</span> <span style="color: #808080;">&quot;HOTSYNC&quot;</span> <span style="color: #FF8000;">Then</span>
            hotSyncProcess <span style="color: #008000;">=</span> p
        <span style="color: #0600FF;">End</span> <span style="color: #0600FF;">If</span>
    <span style="color: #FF8000;">Next</span>
&nbsp;
    <span style="color: #0600FF;">If</span> hotSyncProcess <span style="color: #FF8000;">IsNot</span> <span style="color: #FF8000;">Nothing</span> <span style="color: #FF8000;">Then</span>
        versionString <span style="color: #008000;">=</span> hotSyncProcess.<span style="color: #0000FF;">MainModule</span>.<span style="color: #0000FF;">FileVersionInfo</span>.<span style="color: #0000FF;">FileVersion</span>
    <span style="color: #0600FF;">End</span> <span style="color: #0600FF;">If</span>
&nbsp;
    <span style="color: #FF8000;">Return</span> versionString
&nbsp;
<span style="color: #0600FF;">End</span> <span style="color: #0600FF;">Function</span></pre></div></div>

<p>Sorry I missed the CIDUG meeting tonight.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.dosomethinghere.com/2009/11/24/how-to-get-the-version-number-of-a-running-process/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>NetCFSvcUtil.exe error in Windows 7</title>
		<link>http://www.dosomethinghere.com/2009/10/08/netcfsvcutil-exe-error-in-windows-7/</link>
		<comments>http://www.dosomethinghere.com/2009/10/08/netcfsvcutil-exe-error-in-windows-7/#comments</comments>
		<pubDate>Thu, 08 Oct 2009 17:59:46 +0000</pubDate>
		<dc:creator>BP</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[Visual Basic]]></category>
		<category><![CDATA[Windows Mobile]]></category>
		<category><![CDATA[C#.NET]]></category>
		<category><![CDATA[VB.NET]]></category>

		<guid isPermaLink="false">http://www.dosomethinghere.com/?p=339</guid>
		<description><![CDATA[I have been using Windows 7 for a while now, and always had to keep my Windows XP dev machine handy to help out with my Windows Mobile software development.
It turns out that the NetCFSvcUtil application included in the .NET CF Power Toys did not get along with Windows 7 (neither the RC or the [...]]]></description>
			<content:encoded><![CDATA[<p>I have been using Windows 7 for a while now, and always had to keep my Windows XP dev machine handy to help out with my Windows Mobile software development.</p>
<p>It turns out that the NetCFSvcUtil application included in the .NET CF Power Toys did not get along with Windows 7 (neither the RC or the RTM bits), as it gave a cryptic error message of &#8220;An error occurred in the tool&#8221;.</p>
<p>So just for giggles, I decided to see if there were any updates, and lo and behold, I found a blog post from Habib Heydarian with an updated application:</p>
<p><a href="http://blogs.msdn.com/habibh/archive/2009/06/26/netcfsvcutil-exe-and-windows-7.aspx" target="_blank">NetCFSvcUtil.exe and Windows 7</a></p>
<p>Now I can happily generate the client code on my Windows 7 machine.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.dosomethinghere.com/2009/10/08/netcfsvcutil-exe-error-in-windows-7/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Monty Hall meets Monte Carlo</title>
		<link>http://www.dosomethinghere.com/2009/09/24/monty-hall-meets-monte-carlo/</link>
		<comments>http://www.dosomethinghere.com/2009/09/24/monty-hall-meets-monte-carlo/#comments</comments>
		<pubDate>Fri, 25 Sep 2009 01:07:49 +0000</pubDate>
		<dc:creator>BP</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[Visual Basic]]></category>
		<category><![CDATA[VB.NET]]></category>

		<guid isPermaLink="false">http://www.dosomethinghere.com/?p=311</guid>
		<description><![CDATA[In honor of CBS canceling The Guiding Light after 72 years, and replacing it with a new incantation of Let&#8217;s Make A Deal, I decided to apply a little brute force computing to The Monty Hall problem.
Here is the VB.NET code to run the simulations. I decided to only apply a few different Monty Hall [...]]]></description>
			<content:encoded><![CDATA[<p>In honor of CBS canceling The Guiding Light after 72 years, and replacing it with a new incantation of Let&#8217;s Make A Deal, I decided to apply a little brute force computing to <a href="http://en.wikipedia.org/wiki/Monty_Hall_problem" target="_blank">The Monty Hall problem</a>.</p>
<p>Here is the VB.NET code to run the simulations. I decided to only apply a few different Monty Hall behaviors and a few different player behaviors, but it should be enough to drive home the paradox.</p>

<div class="wp_syntax"><div class="code"><pre class="vbnet" style="font-family:monospace;">Module Module1
&nbsp;
    <span style="color: #0600FF;">Sub</span> Main<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>
&nbsp;
        <span style="color: #0600FF;">Dim</span> i, j, ctr <span style="color: #FF8000;">As</span> <span style="color: #FF0000;">Integer</span>
        <span style="color: #0600FF;">Dim</span> doorSwitch <span style="color: #FF8000;">As</span> <span style="color: #FF8000;">String</span> <span style="color: #008000;">=</span> <span style="color: #808080;">&quot;?&quot;</span>
        <span style="color: #0600FF;">Dim</span> smartMonty <span style="color: #FF8000;">As</span> <span style="color: #FF8000;">String</span> <span style="color: #008000;">=</span> <span style="color: #808080;">&quot;?&quot;</span>
        <span style="color: #0600FF;">Dim</span> prizeDoor<span style="color: #000000;">&#40;</span><span style="color: #FF0000;">3</span><span style="color: #000000;">&#41;</span> <span style="color: #FF8000;">As</span> <span style="color: #FF0000;">Boolean</span>
        <span style="color: #0600FF;">Dim</span> rand <span style="color: #FF8000;">As</span> Random <span style="color: #008000;">=</span> <span style="color: #FF8000;">New</span> Random<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>
        <span style="color: #0600FF;">Dim</span> doorMontyOpens <span style="color: #FF8000;">As</span> <span style="color: #FF0000;">Integer</span>
        <span style="color: #0600FF;">Dim</span> doorYouOpen <span style="color: #FF8000;">As</span> <span style="color: #FF0000;">Integer</span>
        <span style="color: #0600FF;">Dim</span> carsWon <span style="color: #FF8000;">As</span> <span style="color: #FF0000;">Integer</span> <span style="color: #008000;">=</span> <span style="color: #FF0000;">0</span>
&nbsp;
        Console.<span style="color: #0000FF;">WriteLine</span><span style="color: #000000;">&#40;</span><span style="color: #808080;">&quot;The Monty Hall Problem&quot;</span><span style="color: #000000;">&#41;</span>
        Console.<span style="color: #0600FF;">Write</span><span style="color: #000000;">&#40;</span><span style="color: #808080;">&quot;How many times to run the simulation? &quot;</span><span style="color: #000000;">&#41;</span>
        ctr <span style="color: #008000;">=</span> <span style="color: #0600FF;">Val</span><span style="color: #000000;">&#40;</span>Console.<span style="color: #0000FF;">ReadLine</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>
        <span style="color: #0600FF;">If</span> ctr &lt; <span style="color: #FF0000;">1</span> <span style="color: #FF8000;">Then</span> <span style="color: #0600FF;">End</span>
&nbsp;
        Console.<span style="color: #0600FF;">Write</span><span style="color: #000000;">&#40;</span><span style="color: #808080;">&quot;Are you going to switch doors? [Y/N/M] &quot;</span><span style="color: #000000;">&#41;</span>
        <span style="color: #0600FF;">While</span> <span style="color: #804040;">Not</span> <span style="color: #808080;">&quot;YNM&quot;</span>.<span style="color: #0000FF;">Contains</span><span style="color: #000000;">&#40;</span>doorSwitch<span style="color: #000000;">&#41;</span>
            doorSwitch <span style="color: #008000;">=</span> Console.<span style="color: #0000FF;">ReadKey</span>.<span style="color: #0000FF;">KeyChar</span>.<span style="color: #0000FF;">ToString</span>.<span style="color: #0000FF;">ToUpper</span>
        <span style="color: #0600FF;">End</span> <span style="color: #0600FF;">While</span>
        Console.<span style="color: #0000FF;">WriteLine</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>
&nbsp;
        Console.<span style="color: #0600FF;">Write</span><span style="color: #000000;">&#40;</span><span style="color: #808080;">&quot;Does Monty know where the car is? [Y/N/M] &quot;</span><span style="color: #000000;">&#41;</span>
        <span style="color: #0600FF;">While</span> <span style="color: #804040;">Not</span> <span style="color: #808080;">&quot;YNM&quot;</span>.<span style="color: #0000FF;">Contains</span><span style="color: #000000;">&#40;</span>smartMonty<span style="color: #000000;">&#41;</span>
            smartMonty <span style="color: #008000;">=</span> Console.<span style="color: #0000FF;">ReadKey</span>.<span style="color: #0000FF;">KeyChar</span>.<span style="color: #0000FF;">ToString</span>.<span style="color: #0000FF;">ToUpper</span>
        <span style="color: #0600FF;">End</span> <span style="color: #0600FF;">While</span>
        Console.<span style="color: #0000FF;">WriteLine</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>
&nbsp;
        <span style="color: #FF8000;">For</span> i <span style="color: #008000;">=</span> <span style="color: #FF0000;">1</span> <span style="color: #FF8000;">To</span> ctr
&nbsp;
            <span style="color: #008080; font-style: italic;">' set up the prize doors</span>
            <span style="color: #FF8000;">For</span> j <span style="color: #008000;">=</span> <span style="color: #FF0000;">1</span> <span style="color: #FF8000;">To</span> <span style="color: #FF0000;">3</span>
                prizeDoor<span style="color: #000000;">&#40;</span>j<span style="color: #000000;">&#41;</span> <span style="color: #008000;">=</span> <span style="color: #0600FF;">False</span>
            <span style="color: #FF8000;">Next</span>
            prizeDoor<span style="color: #000000;">&#40;</span>rand.<span style="color: #FF8000;">Next</span><span style="color: #000000;">&#40;</span><span style="color: #FF0000;">1</span>, <span style="color: #FF0000;">4</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span> <span style="color: #008000;">=</span> <span style="color: #0600FF;">True</span>
&nbsp;
            Console.<span style="color: #0600FF;">Write</span><span style="color: #000000;">&#40;</span>i.<span style="color: #0000FF;">ToString</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #008000;">+</span> <span style="color: #808080;">&quot; (&quot;</span><span style="color: #000000;">&#41;</span>
            <span style="color: #FF8000;">For</span> j <span style="color: #008000;">=</span> <span style="color: #FF0000;">1</span> <span style="color: #FF8000;">To</span> <span style="color: #FF0000;">3</span>
                Console.<span style="color: #0600FF;">Write</span><span style="color: #000000;">&#40;</span><span style="color: #0600FF;">If</span><span style="color: #000000;">&#40;</span>prizeDoor<span style="color: #000000;">&#40;</span>j<span style="color: #000000;">&#41;</span>, <span style="color: #808080;">&quot;$&quot;</span>, j.<span style="color: #0000FF;">ToString</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>
            <span style="color: #FF8000;">Next</span>
            Console.<span style="color: #0600FF;">Write</span><span style="color: #000000;">&#40;</span><span style="color: #808080;">&quot;) -- &quot;</span><span style="color: #000000;">&#41;</span>
&nbsp;
            <span style="color: #008080; font-style: italic;">' Monty shows you a door</span>
            <span style="color: #0600FF;">If</span> smartMonty <span style="color: #008000;">=</span> <span style="color: #808080;">&quot;Y&quot;</span> Or <span style="color: #000000;">&#40;</span>smartMonty <span style="color: #008000;">=</span> <span style="color: #808080;">&quot;M&quot;</span> <span style="color: #804040;">And</span> _
                                    rand.<span style="color: #0000FF;">NextDouble</span> &gt; <span style="color: #FF0000;">0.5</span><span style="color: #000000;">&#41;</span> <span style="color: #FF8000;">Then</span>
                doorMontyOpens <span style="color: #008000;">=</span> <span style="color: #0600FF;">If</span><span style="color: #000000;">&#40;</span>prizeDoor<span style="color: #000000;">&#40;</span><span style="color: #FF0000;">2</span><span style="color: #000000;">&#41;</span>, <span style="color: #FF0000;">3</span>, <span style="color: #FF0000;">2</span><span style="color: #000000;">&#41;</span>
            <span style="color: #FF8000;">Else</span>
                doorMontyOpens <span style="color: #008000;">=</span> rand.<span style="color: #FF8000;">Next</span><span style="color: #000000;">&#40;</span><span style="color: #FF0000;">2</span>, <span style="color: #FF0000;">4</span><span style="color: #000000;">&#41;</span>
                <span style="color: #0600FF;">If</span> prizeDoor<span style="color: #000000;">&#40;</span>doorMontyOpens<span style="color: #000000;">&#41;</span> <span style="color: #FF8000;">Then</span>
                    carsWon <span style="color: #008000;">=</span> carsWon <span style="color: #008000;">+</span> <span style="color: #FF0000;">1</span>
                    Console.<span style="color: #0000FF;">WriteLine</span><span style="color: #000000;">&#40;</span><span style="color: #808080;">&quot;Monty revealed the car!!!!!&quot;</span><span style="color: #000000;">&#41;</span>
                    Continue <span style="color: #FF8000;">For</span>
                <span style="color: #0600FF;">End</span> <span style="color: #0600FF;">If</span>
            <span style="color: #0600FF;">End</span> <span style="color: #0600FF;">If</span>
            Console.<span style="color: #0600FF;">Write</span><span style="color: #000000;">&#40;</span><span style="color: #808080;">&quot;Monty reveals a goat behind door #&quot;</span> <span style="color: #008000;">+</span> _
                          doorMontyOpens.<span style="color: #0000FF;">ToString</span> <span style="color: #008000;">+</span> <span style="color: #808080;">&quot; -- &quot;</span><span style="color: #000000;">&#41;</span>
&nbsp;
            <span style="color: #008080; font-style: italic;">' pick a door to open</span>
            <span style="color: #0600FF;">If</span> doorSwitch <span style="color: #008000;">=</span> <span style="color: #808080;">&quot;Y&quot;</span> Or <span style="color: #000000;">&#40;</span>doorSwitch <span style="color: #008000;">=</span> <span style="color: #808080;">&quot;M&quot;</span> <span style="color: #804040;">And</span> _
                                  rand.<span style="color: #0000FF;">NextDouble</span> &gt; <span style="color: #FF0000;">0.5</span><span style="color: #000000;">&#41;</span> <span style="color: #FF8000;">Then</span>
                doorYouOpen <span style="color: #008000;">=</span> <span style="color: #0600FF;">If</span><span style="color: #000000;">&#40;</span>doorMontyOpens <span style="color: #008000;">=</span> <span style="color: #FF0000;">2</span>, <span style="color: #FF0000;">3</span>, <span style="color: #FF0000;">2</span><span style="color: #000000;">&#41;</span>
                Console.<span style="color: #0600FF;">Write</span><span style="color: #000000;">&#40;</span><span style="color: #808080;">&quot;You switched to door #&quot;</span> <span style="color: #008000;">+</span> _
                              doorYouOpen.<span style="color: #0000FF;">ToString</span> <span style="color: #008000;">+</span> <span style="color: #808080;">&quot; -- &quot;</span><span style="color: #000000;">&#41;</span>
            <span style="color: #FF8000;">Else</span>
                doorYouOpen <span style="color: #008000;">=</span> <span style="color: #FF0000;">1</span>
                Console.<span style="color: #0600FF;">Write</span><span style="color: #000000;">&#40;</span><span style="color: #808080;">&quot;You stayed with door #1 -- &quot;</span><span style="color: #000000;">&#41;</span>
            <span style="color: #0600FF;">End</span> <span style="color: #0600FF;">If</span>
&nbsp;
            <span style="color: #008080; font-style: italic;">' did we win?</span>
            <span style="color: #0600FF;">If</span> prizeDoor<span style="color: #000000;">&#40;</span>doorYouOpen<span style="color: #000000;">&#41;</span> <span style="color: #FF8000;">Then</span>
                Console.<span style="color: #0000FF;">WriteLine</span><span style="color: #000000;">&#40;</span><span style="color: #808080;">&quot;You won the car!!!!!&quot;</span><span style="color: #000000;">&#41;</span>
                carsWon <span style="color: #008000;">=</span> carsWon <span style="color: #008000;">+</span> <span style="color: #FF0000;">1</span>
            <span style="color: #FF8000;">Else</span>
                Console.<span style="color: #0000FF;">WriteLine</span><span style="color: #000000;">&#40;</span><span style="color: #808080;">&quot;You won the goat.&quot;</span><span style="color: #000000;">&#41;</span>
            <span style="color: #0600FF;">End</span> <span style="color: #0600FF;">If</span>
&nbsp;
        <span style="color: #FF8000;">Next</span>
&nbsp;
        Console.<span style="color: #0000FF;">WriteLine</span><span style="color: #000000;">&#40;</span><span style="color: #808080;">&quot; &quot;</span><span style="color: #000000;">&#41;</span>
        Console.<span style="color: #0000FF;">WriteLine</span><span style="color: #000000;">&#40;</span><span style="color: #808080;">&quot;You won the car &quot;</span> <span style="color: #008000;">+</span> carsWon.<span style="color: #0000FF;">ToString</span> <span style="color: #008000;">+</span> _
                          <span style="color: #808080;">&quot; times out of &quot;</span> <span style="color: #008000;">+</span> ctr.<span style="color: #0000FF;">ToString</span><span style="color: #000000;">&#41;</span>
        Console.<span style="color: #0000FF;">WriteLine</span><span style="color: #000000;">&#40;</span><span style="color: #808080;">&quot;Winning percentage: &quot;</span> <span style="color: #008000;">+</span> <span style="color: #000000;">&#40;</span>carsWon <span style="color: #008000;">*</span> _
                            <span style="color: #FF0000;">100.0</span> <span style="color: #008000;">/</span> ctr<span style="color: #000000;">&#41;</span>.<span style="color: #0000FF;">ToString</span><span style="color: #000000;">&#40;</span><span style="color: #808080;">&quot;##0.0&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>
        Console.<span style="color: #0000FF;">WriteLine</span><span style="color: #000000;">&#40;</span><span style="color: #808080;">&quot; &quot;</span><span style="color: #000000;">&#41;</span>
        Console.<span style="color: #0000FF;">WriteLine</span><span style="color: #000000;">&#40;</span><span style="color: #808080;">&quot;Strike any key to end...&quot;</span><span style="color: #000000;">&#41;</span>
        Console.<span style="color: #0000FF;">ReadKey</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>
&nbsp;
    <span style="color: #0600FF;">End</span> <span style="color: #0600FF;">Sub</span>
&nbsp;
<span style="color: #0600FF;">End</span> Module</pre></div></div>

<p>Now if CBS ever decides to cancel The Young And The Restless, we are going to have a real problem on our hands.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.dosomethinghere.com/2009/09/24/monty-hall-meets-monte-carlo/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Retrosheet.org play-by-play baseball data</title>
		<link>http://www.dosomethinghere.com/2009/09/20/retrosheet-org-play-by-play-baseball-data/</link>
		<comments>http://www.dosomethinghere.com/2009/09/20/retrosheet-org-play-by-play-baseball-data/#comments</comments>
		<pubDate>Sun, 20 Sep 2009 22:26:41 +0000</pubDate>
		<dc:creator>BP</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[Retrosheet]]></category>
		<category><![CDATA[Visual Basic]]></category>

		<guid isPermaLink="false">http://www.dosomethinghere.com/?p=296</guid>
		<description><![CDATA[I have thought for a long time that Retrosheet.org was a pretty neat web site with the potential for a ton of baseball information.
They have loads of stats on their site, but it can be hard to get at sometimes.  As a result, I thought I might do some coding against their data just for [...]]]></description>
			<content:encoded><![CDATA[<p>I have thought for a long time that Retrosheet.org was a pretty neat web site with the potential for a ton of baseball information.</p>
<p>They have loads of stats on their site, but it can be hard to get at sometimes.  As a result, I thought I might do some coding against their data just for fun. (I am doing this mainly because I am bored, because the Steelers are not on TV here in Ohio today, and because cable does not carry the NFL Sunday Ticket.)</p>
<p>The first task is to take their event data files and get them into a format that can be easily read and parsed. There are zip files on the Retrosheet web site to download entire seasons worth of event data, just go to retrosheet.org, hover over Data downloads, and select Play-by-play files.</p>
<p>However, once you look at these event files, you discover that they may need a little interpreting to get them into a nicer format for study. Luckily, Tom Tippett, David Nichols, and David W. Smith wrote a DOS application that does this, you just need to run this BEVENT.EXE file on each of the event files.</p>
<p>And of course, I couldn&#8217;t simply do that, I had to write a VB.NET console application to create a batch file do automate this.</p>

<div class="wp_syntax"><div class="code"><pre class="vbnet" style="font-family:monospace;"><span style="color: #0600FF;">Imports</span> System.<span style="color: #0000FF;">IO</span>
&nbsp;
Module Module1
&nbsp;
    <span style="color: #0600FF;">Sub</span> Main<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>
&nbsp;
        Console.<span style="color: #0000FF;">WriteLine</span><span style="color: #000000;">&#40;</span><span style="color: #808080;">&quot;BEvent Helper&quot;</span><span style="color: #000000;">&#41;</span>
        Console.<span style="color: #0600FF;">Write</span><span style="color: #000000;">&#40;</span><span style="color: #808080;">&quot;Enter the directory of your event files: &quot;</span><span style="color: #000000;">&#41;</span>
        <span style="color: #0600FF;">Dim</span> d <span style="color: #FF8000;">As</span> <span style="color: #FF8000;">String</span> <span style="color: #008000;">=</span> Console.<span style="color: #0000FF;">ReadLine</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>
&nbsp;
        <span style="color: #0600FF;">If</span> d.<span style="color: #0600FF;">Trim</span> <span style="color: #008000;">=</span> <span style="color: #808080;">&quot;&quot;</span> Or <span style="color: #804040;">Not</span> <span style="color: #0600FF;">Directory</span>.<span style="color: #0000FF;">Exists</span><span style="color: #000000;">&#40;</span>d<span style="color: #000000;">&#41;</span> <span style="color: #FF8000;">Then</span> GoTo App_end
        <span style="color: #0600FF;">If</span> <span style="color: #0600FF;">Right</span><span style="color: #000000;">&#40;</span>d, <span style="color: #FF0000;">1</span><span style="color: #000000;">&#41;</span> &lt;&gt; <span style="color: #808080;">&quot;\&quot;</span> <span style="color: #FF8000;">Then</span> d <span style="color: #008000;">=</span> d <span style="color: #008000;">+</span> <span style="color: #808080;">&quot;\&quot;</span>
&nbsp;
        <span style="color: #0600FF;">Dim</span> eventFilenames <span style="color: #FF8000;">As</span> List<span style="color: #000000;">&#40;</span>Of <span style="color: #FF8000;">String</span><span style="color: #000000;">&#41;</span>
        eventFilenames <span style="color: #008000;">=</span> <span style="color: #0600FF;">Directory</span>.<span style="color: #0000FF;">GetFiles</span><span style="color: #000000;">&#40;</span>d, <span style="color: #808080;">&quot;*.ev?&quot;</span><span style="color: #000000;">&#41;</span>.<span style="color: #0000FF;">ToList</span>
&nbsp;
        <span style="color: #0600FF;">Dim</span> s, cmd <span style="color: #FF8000;">As</span> <span style="color: #FF8000;">String</span>
        <span style="color: #0600FF;">Dim</span> sw <span style="color: #FF8000;">As</span> StreamWriter <span style="color: #008000;">=</span> <span style="color: #FF8000;">New</span> StreamWriter<span style="color: #000000;">&#40;</span>d <span style="color: #008000;">+</span> <span style="color: #808080;">&quot;BEventHelper.bat&quot;</span><span style="color: #000000;">&#41;</span>
        <span style="color: #FF8000;">For</span> <span style="color: #0600FF;">Each</span> f In eventFilenames
            s <span style="color: #008000;">=</span> Path.<span style="color: #0000FF;">GetFileName</span><span style="color: #000000;">&#40;</span>f<span style="color: #000000;">&#41;</span>
            cmd <span style="color: #008000;">=</span> <span style="color: #808080;">&quot;bevent.exe -f 0-96 -y &quot;</span> <span style="color: #008000;">+</span> <span style="color: #0600FF;">Left</span><span style="color: #000000;">&#40;</span>s, <span style="color: #FF0000;">4</span><span style="color: #000000;">&#41;</span> <span style="color: #008000;">+</span> <span style="color: #808080;">&quot; &quot;</span> <span style="color: #008000;">+</span> s <span style="color: #008000;">+</span> <span style="color: #808080;">&quot; &gt; &quot;</span> <span style="color: #008000;">+</span> s <span style="color: #008000;">+</span> <span style="color: #808080;">&quot;.csv&quot;</span>
            sw.<span style="color: #0000FF;">WriteLine</span><span style="color: #000000;">&#40;</span>cmd<span style="color: #000000;">&#41;</span>
        <span style="color: #FF8000;">Next</span>
        sw.<span style="color: #0000FF;">WriteLine</span><span style="color: #000000;">&#40;</span><span style="color: #808080;">&quot;pause&quot;</span><span style="color: #000000;">&#41;</span>
        sw.<span style="color: #0600FF;">Close</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>
&nbsp;
App_end:
        Console.<span style="color: #0000FF;">WriteLine</span><span style="color: #000000;">&#40;</span><span style="color: #808080;">&quot;Press any key to end application...&quot;</span><span style="color: #000000;">&#41;</span>
        Console.<span style="color: #0000FF;">ReadKey</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>
&nbsp;
    <span style="color: #0600FF;">End</span> <span style="color: #0600FF;">Sub</span>
&nbsp;
<span style="color: #0600FF;">End</span> Module</pre></div></div>

<p>So what you do is download a season zip file (such as the <a href="http://www.retrosheet.org/2008/2008ml.htm" target="_blank">2008 Major League season</a>), unzip the files into a directory, download the bevent.zip file from the <a href="http://www.retrosheet.org/tools.htm" target="_blank">Software tools</a> page, unzip it and place the BEVENT.EXE file into the directory with all the event files, run the console application and enter the directory name at the prompt, and when it is all said and done, you have a BEventHelper.bat file in the directory. Once this file is run, you will end up with CSV files that correspond to the event files.</p>
<p>In the next episode, I will begin to read in the data and crank out some preliminary statistics.</p>
<p>Disclaimer: The information used here was obtained free of charge from and is copyrighted by Retrosheet.  Interested parties may contact Retrosheet at &#8220;www.retrosheet.org&#8221;.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.dosomethinghere.com/2009/09/20/retrosheet-org-play-by-play-baseball-data/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
