<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:copyright="http://blogs.law.harvard.edu/tech/rss" xmlns:image="http://purl.org/rss/1.0/modules/image/">
    <channel>
        <title>VB .NET</title>
        <link>http://www.wtfnext.com/category/8744.aspx</link>
        <description>These posts relate to VB .NET, at least partially.</description>
        <language>en-US</language>
        <copyright>Stacy Vicknair</copyright>
        <managingEditor>svickn@gmail.com</managingEditor>
        <generator>Subtext Version 0.0.0.0</generator>
        <item>
            <title>Automating SQL Server 2000 based database generation with OSQL in .NET</title>
            <link>http://wtfnext.com/archive/2009/08/14/automating-sql-server-2000-based-database-generation-with-osql-in.aspx</link>
            <description>&lt;p&gt; This week I had a need for NUnit based unit testing against a class that depended on a provided SqlConnection. Up to this point I had been able to mock external objects and their behavior based on interfaces, but with a SqlConnection I could not mock. There are some options for mocking the SqlConnection such as &lt;a href="http://www.typemock.com/"&gt;TypeMock&lt;/a&gt;, but I needed a realistic connection to test against. This also proved as a good method for building the expected DB interface.&lt;/p&gt;  &lt;p&gt;The solution that worked best for my environment (only SQL Server 2000, all machines have OSQL) was to execute an OSQL process from my &lt;strong&gt;TestFixtureSetUp&lt;/strong&gt; that executed a .sql script I had already made for building the database. So my &lt;strong&gt;TestFixtureSetUp&lt;/strong&gt; looked like this:&lt;/p&gt;  &lt;pre class="code"&gt;&amp;lt;TestFixtureSetUp()&amp;gt; _
&lt;span style="color: blue"&gt;Sub &lt;/span&gt;FixtureSetUp()
    &lt;span style="color: blue"&gt;Dim &lt;/span&gt;p &lt;span style="color: blue"&gt;As &lt;/span&gt;Process = Process.Start("OSQL.exe", "-E -S SERVER -i ""../SQL SCRIPTS/setup.sql""")
    p.WaitForExit()
&lt;span style="color: blue"&gt;End Sub&lt;/span&gt;&lt;/pre&gt;

&lt;p&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;The script itself was quick and assumed that the database and procedures existed already. It deleted all entries from the table and then added some dummy values. However, this method could be used to create the entire DB if needed, but does have the strong assumption that the computer using it has OSQL installed.&lt;/p&gt;

&lt;p&gt;I won’t go into much detail about OSQL. OSQL is a tool that comes with SQL Server Tools that allows execution of sql batch scripts from the command-line. Its usage is &lt;a href="http://msdn.microsoft.com/en-us/library/aa213090(SQL.80).aspx"&gt;explained well in the MSDN&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt; &lt;/p&gt;

&lt;div class="wlWriterEditableSmartContent" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:5c3fd34a-f5db-4303-86f6-90ec28cbff2b" style="padding-right: 0px; display: inline; padding-left: 0px; float: none; padding-bottom: 0px; margin: 0px; padding-top: 0px"&gt;Technorati Tags: &lt;a href="http://technorati.com/tags/OSQL" rel="tag"&gt;OSQL&lt;/a&gt;,&lt;a href="http://technorati.com/tags/database+generation" rel="tag"&gt;database generation&lt;/a&gt;,&lt;a href="http://technorati.com/tags/NUnit" rel="tag"&gt;NUnit&lt;/a&gt;,&lt;a href="http://technorati.com/tags/unit+testing" rel="tag"&gt;unit testing&lt;/a&gt;,&lt;a href="http://technorati.com/tags/sql+server+2000" rel="tag"&gt;sql server 2000&lt;/a&gt;&lt;/div&gt;&lt;p&gt;&lt;a href="http://www.pheedo.com/click.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=134105"&gt;&lt;img src="http://www.pheedo.com/img.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=134105" border="0"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;iframe src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;PageID=31016&amp;amp;SiteID=1" width=1 height=1 Marginwidth=0 Marginheight=0 Hspace=0 Vspace=0 Frameborder=0 Scrolling=No&gt;
&lt;script language='javascript1.1' src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Browser=NETSCAPE4&amp;amp;NoCache=True&amp;PageID=31016&amp;amp;SiteID=1"&gt;&lt;/script&gt;
&lt;noscript&gt;&lt;a href="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Click&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" target="_blank"&gt;
&lt;img src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" width="1" height="1" border="0"  alt=""&gt;&lt;/a&gt;
&lt;/noscript&gt;
&lt;/iframe&gt;
&lt;img src="http://wtfnext.com/aggbug/134105.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Stacy Vicknair</dc:creator>
            <guid>http://wtfnext.com/archive/2009/08/14/automating-sql-server-2000-based-database-generation-with-osql-in.aspx</guid>
            <pubDate>Fri, 14 Aug 2009 16:55:14 GMT</pubDate>
            <wfw:comment>http://wtfnext.com/comments/134105.aspx</wfw:comment>
            <comments>http://wtfnext.com/archive/2009/08/14/automating-sql-server-2000-based-database-generation-with-osql-in.aspx#feedback</comments>
            <wfw:commentRss>http://wtfnext.com/comments/commentRss/134105.aspx</wfw:commentRss>
            <trackback:ping>http://wtfnext.com/services/trackbacks/134105.aspx</trackback:ping>
        </item>
        <item>
            <title>List of influential VB&amp;rsquo;ers on Twitter</title>
            <link>http://wtfnext.com/archive/2009/07/01/list-of-influential-vbrsquoers-on-twitter.aspx</link>
            <description>&lt;p&gt;Antonio Chagoury, VB MVP, has constructed a list of Twitter accounts for VB MVPs, VB Team members, and others who are influential in the VB.NET community on his personal blog, &lt;a href="http://www.cto20.com"&gt;CTO v2.0&lt;/a&gt;. This list has many great people who are not only talented in VB, but also who have great talents in many aspects of the .NET framework.&lt;/p&gt;
&lt;p&gt;I’m listed as a VB MVP, but if you don’t want the full list you can still check me out at &lt;a href="http://twitter.com/svickn"&gt;http://twitter.com/svickn&lt;/a&gt;. However, I’d recommend checking out the rest of these guys too, you might find someone you would never have thought to follow that you mesh with. Besides, it’s never a bad thing when .NET help is just a tweet away ;)&lt;/p&gt;
&lt;p&gt;&lt;a title="http://www.cto20.com/post/Tweeps-List-Microsoft-Visual-Basic-MVPe28099s-and-Influencers.aspx" href="http://www.cto20.com/post/Tweeps-List-Microsoft-Visual-Basic-MVPe28099s-and-Influencers.aspx"&gt;http://www.cto20.com/post/Tweeps-List-Microsoft-Visual-Basic-MVPe28099s-and-Influencers.aspx&lt;/a&gt;&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;div class="wlWriterEditableSmartContent" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:1a0fcb36-cd55-481f-9652-d0282f18ca25" style="PADDING-RIGHT: 0px; DISPLAY: inline; PADDING-LEFT: 0px; FLOAT: none; PADDING-BOTTOM: 0px; MARGIN: 0px; PADDING-TOP: 0px"&gt;Technorati Tags: &lt;a rel="tag" href="http://technorati.com/tags/VB.NET"&gt;VB.NET&lt;/a&gt;,&lt;a rel="tag" href="http://technorati.com/tags/Twitter"&gt;Twitter&lt;/a&gt;,&lt;a rel="tag" href="http://technorati.com/tags/.NET"&gt;.NET&lt;/a&gt;&lt;/div&gt;&lt;p&gt;&lt;a href="http://www.pheedo.com/click.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=133197"&gt;&lt;img src="http://www.pheedo.com/img.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=133197" border="0"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;iframe src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;PageID=31016&amp;amp;SiteID=1" width=1 height=1 Marginwidth=0 Marginheight=0 Hspace=0 Vspace=0 Frameborder=0 Scrolling=No&gt;
&lt;script language='javascript1.1' src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Browser=NETSCAPE4&amp;amp;NoCache=True&amp;PageID=31016&amp;amp;SiteID=1"&gt;&lt;/script&gt;
&lt;noscript&gt;&lt;a href="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Click&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" target="_blank"&gt;
&lt;img src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" width="1" height="1" border="0"  alt=""&gt;&lt;/a&gt;
&lt;/noscript&gt;
&lt;/iframe&gt;
&lt;img src="http://wtfnext.com/aggbug/133197.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Stacy Vicknair</dc:creator>
            <guid>http://wtfnext.com/archive/2009/07/01/list-of-influential-vbrsquoers-on-twitter.aspx</guid>
            <pubDate>Wed, 01 Jul 2009 21:04:45 GMT</pubDate>
            <wfw:comment>http://wtfnext.com/comments/133197.aspx</wfw:comment>
            <comments>http://wtfnext.com/archive/2009/07/01/list-of-influential-vbrsquoers-on-twitter.aspx#feedback</comments>
            <slash:comments>2</slash:comments>
            <wfw:commentRss>http://wtfnext.com/comments/commentRss/133197.aspx</wfw:commentRss>
            <trackback:ping>http://wtfnext.com/services/trackbacks/133197.aspx</trackback:ping>
        </item>
        <item>
            <title>How To: Create a plugin architecture in VB.NET</title>
            <link>http://wtfnext.com/archive/2009/05/06/how-to-create-a-plugin-architecture-in-vb.net.aspx</link>
            <description>&lt;p&gt;Creating a plugin architecture in .NET can be achieved in a few steps using the .NET framework. All it takes is a little time, a common interface and reflection. In this blog we’re going to look at how to make a simple plugin that performs basic integer calculations. &lt;span style="font-weight: bold; font-style: italic;"&gt;As a disclaimer, this method is not CLS compliant.&lt;/span&gt; If that is necessary for you, then stick around and I hope to have a new version that maintains compliance posted.&lt;br /&gt;
&lt;/p&gt;
&lt;p&gt;The code in this blog is mostly illustrative, and the full code is available on CodePlex at the following link:&lt;/p&gt;
&lt;p&gt;&lt;a href="http://wtfnext.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=27051" title="http://wtfnext.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=27051"&gt;http://wtfnext.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=27051&lt;/a&gt;&lt;/p&gt;
&lt;h1&gt;Setting up a common interface&lt;/h1&gt;
&lt;p&gt;Our main console application has to know just basic things about our plugin. It doesn’t need to know any more about it than that it complies to an expected interface. For this example, our plugins must:&lt;/p&gt;
&lt;ul&gt;
    &lt;li&gt;Expose a class named Plugin&lt;/li&gt;
    &lt;li&gt;The class must implement our common interface: IPlugin.&lt;/li&gt;
    &lt;li&gt;The plugin must end in “Plugin.dll” and be present in the application directory.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;If we get all of these done, we can connect to the plugin successfully. The first step is to define the IPlugin interface, which acts as the basic contract between any plugin and the console application. We’ll place this in its own project to compile into a separate DLL, so that we can easily reference it from our plugin projects.&lt;/p&gt;
&lt;pre class="code"&gt;&lt;span style="color: blue;"&gt;Public Interface &lt;/span&gt;IPlugin&lt;br /&gt;    &lt;span style="color: blue;"&gt;ReadOnly Property &lt;/span&gt;Name() &lt;span style="color: blue;"&gt;As String&lt;br /&gt;    ReadOnly Property &lt;/span&gt;ActionName() &lt;span style="color: blue;"&gt;As String&lt;br /&gt;    Sub &lt;/span&gt;Calculate(&lt;span style="color: blue;"&gt;ByVal &lt;/span&gt;value1 &lt;span style="color: blue;"&gt;As Integer&lt;/span&gt;, &lt;span style="color: blue;"&gt;ByVal &lt;/span&gt;value2 &lt;span style="color: blue;"&gt;As Integer&lt;/span&gt;)&lt;br /&gt;&lt;span style="color: blue;"&gt;End Interface&lt;/span&gt;&lt;/pre&gt;
&lt;h1&gt;
&lt;p&gt;     &lt;/p&gt;
&lt;/h1&gt;
&lt;h1&gt;Consuming the interface according to our rules&lt;/h1&gt;
&lt;p&gt;So our calculation plugins will expose the name, what their action is and a calculate function that operates on two values. We can create an example plugin that performs addition:&lt;/p&gt;
&lt;pre class="code"&gt;&lt;span style="color: blue;"&gt;Public Class &lt;/span&gt;Plugin&lt;br /&gt;    &lt;span style="color: blue;"&gt;Implements &lt;/span&gt;IPlugin&lt;br /&gt;&lt;br /&gt;    &lt;span style="color: blue;"&gt;ReadOnly Public Property &lt;/span&gt;Name() &lt;span style="color: blue;"&gt;As String Implements &lt;/span&gt;IPlugin.Name&lt;br /&gt;        &lt;span style="color: blue;"&gt;Get&lt;br /&gt;            Return &lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;"Addition"&lt;br /&gt;        &lt;/span&gt;&lt;span style="color: blue;"&gt;End Get&lt;br /&gt;    End Property&lt;br /&gt;&lt;br /&gt;    ReadOnly Public Property &lt;/span&gt;ActionName() &lt;span style="color: blue;"&gt;As String Implements &lt;/span&gt;IPlugin.ActionName&lt;br /&gt;        &lt;span style="color: blue;"&gt;Get&lt;br /&gt;            Return &lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;"Add Values"&lt;br /&gt;        &lt;/span&gt;&lt;span style="color: blue;"&gt;End Get&lt;br /&gt;    End Property&lt;br /&gt;&lt;br /&gt;    Public Sub &lt;/span&gt;Calculate (&lt;span style="color: blue;"&gt;ByVal &lt;/span&gt;value1 &lt;span style="color: blue;"&gt;As Integer&lt;/span&gt;, &lt;span style="color: blue;"&gt;ByVal &lt;/span&gt;value2 &lt;span style="color: blue;"&gt;As Integer&lt;/span&gt;) &lt;span style="color: blue;"&gt;Implements &lt;/span&gt;IPlugin.Calculate&lt;br /&gt;        &lt;span style="color: blue;"&gt;Dim &lt;/span&gt;result &lt;span style="color: blue;"&gt;As Integer &lt;/span&gt;= value1 + value2&lt;br /&gt;        MessageBox.Show (&lt;span style="color: rgb(163, 21, 21);"&gt;"The result is " &lt;/span&gt;+ result.ToString)&lt;br /&gt;    &lt;span style="color: blue;"&gt;End Sub&lt;br /&gt;End Class&lt;/span&gt;&lt;/pre&gt;
&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;
&lt;p&gt;See how we named the class that implements the plugin as just Plugin? This is because this is what the consol application expects. We can have other classes and whatnot in our plugin that do the meat of our work, but the application that consumes the plugin only cares that the possible plugin follow our rules stated earlier.&lt;/p&gt;
&lt;h1&gt;Checking and consuming the plugin&lt;/h1&gt;
&lt;p&gt;In our console application, all we’ve got to do is grab our possible plugins, then check their validity. Once we’re sure it is valid, we can consume it via the interface.&lt;/p&gt;
&lt;pre class="code"&gt;&lt;span style="color: blue;"&gt;Dim &lt;/span&gt;asm &lt;span style="color: blue;"&gt;As &lt;/span&gt;Assembly = Assembly.LoadFrom(possiblePlugin)&lt;br /&gt;&lt;span style="color: blue;"&gt;Dim &lt;/span&gt;myType &lt;span style="color: blue;"&gt;As &lt;/span&gt;System.Type = asm.GetType(asm.GetName.Name + &lt;span style="color: rgb(163, 21, 21);"&gt;".Plugin"&lt;/span&gt;)&lt;br /&gt;&lt;span style="color: blue;"&gt;Dim &lt;/span&gt;implementsIPlugin &lt;span style="color: blue;"&gt;As Boolean &lt;/span&gt;= &lt;span style="color: blue;"&gt;GetType&lt;/span&gt;(IPlugin).IsAssignableFrom(myType)&lt;br /&gt;&lt;span style="color: blue;"&gt;If &lt;/span&gt;implementsIPlugin &lt;span style="color: blue;"&gt;Then&lt;br /&gt;    &lt;/span&gt;Console.WriteLine(asm.GetName.Name + &lt;span style="color: rgb(163, 21, 21);"&gt;" is a valid plugin!"&lt;/span&gt;)&lt;br /&gt;&lt;br /&gt;    &lt;span style="color: blue;"&gt;Dim &lt;/span&gt;plugin &lt;span style="color: blue;"&gt;As &lt;/span&gt;IPlugin = &lt;span style="color: blue;"&gt;CType&lt;/span&gt;(Activator.CreateInstance(myType), IPlugin)&lt;br /&gt;    Console.WriteLine(&lt;span style="color: rgb(163, 21, 21);"&gt;"{0}: {1}"&lt;/span&gt;, plugin.Name, plugin.ActionName)&lt;br /&gt;    plugin.Calculate(5, 4)&lt;br /&gt;&lt;span style="color: blue;"&gt;End If&lt;/span&gt;&lt;/pre&gt;
&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;
&lt;h1&gt;Wrapping things up&lt;/h1&gt;
&lt;p&gt;Well, this was a quick and dirty look at implementing your own plugin architecture into your application. Please leave feedback or questions. I’d be happy to hear both!&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;div style="margin: 0px; padding: 0px; display: inline; float: none;" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:425965f3-ceb0-4370-b300-bdfc9054f29a" class="wlWriterEditableSmartContent"&gt;Technorati Tags: &lt;a rel="tag" href="http://technorati.com/tags/VB.NET"&gt;VB.NET&lt;/a&gt;,&lt;a rel="tag" href="http://technorati.com/tags/Plugin"&gt;Plugin&lt;/a&gt;,&lt;a rel="tag" href="http://technorati.com/tags/architecture"&gt;architecture&lt;/a&gt;&lt;/div&gt;&lt;p&gt;&lt;a href="http://www.pheedo.com/click.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=131855"&gt;&lt;img src="http://www.pheedo.com/img.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=131855" border="0"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;iframe src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;PageID=31016&amp;amp;SiteID=1" width=1 height=1 Marginwidth=0 Marginheight=0 Hspace=0 Vspace=0 Frameborder=0 Scrolling=No&gt;
&lt;script language='javascript1.1' src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Browser=NETSCAPE4&amp;amp;NoCache=True&amp;PageID=31016&amp;amp;SiteID=1"&gt;&lt;/script&gt;
&lt;noscript&gt;&lt;a href="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Click&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" target="_blank"&gt;
&lt;img src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" width="1" height="1" border="0"  alt=""&gt;&lt;/a&gt;
&lt;/noscript&gt;
&lt;/iframe&gt;
&lt;img src="http://wtfnext.com/aggbug/131855.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Stacy Vicknair</dc:creator>
            <guid>http://wtfnext.com/archive/2009/05/06/how-to-create-a-plugin-architecture-in-vb.net.aspx</guid>
            <pubDate>Wed, 06 May 2009 18:19:35 GMT</pubDate>
            <wfw:comment>http://wtfnext.com/comments/131855.aspx</wfw:comment>
            <comments>http://wtfnext.com/archive/2009/05/06/how-to-create-a-plugin-architecture-in-vb.net.aspx#feedback</comments>
            <slash:comments>4</slash:comments>
            <wfw:commentRss>http://wtfnext.com/comments/commentRss/131855.aspx</wfw:commentRss>
            <trackback:ping>http://wtfnext.com/services/trackbacks/131855.aspx</trackback:ping>
        </item>
        <item>
            <title>.NET Tip: Using String Constructors</title>
            <link>http://wtfnext.com/archive/2009/05/04/.net-tip-using-string-constructors.aspx</link>
            <description>&lt;p&gt;When we use string so often for its value-like behavior, it is easy to forget that the String class comes with its own constructors, and that there are some tasks you can achieve with the string constructor that you might have overlooked otherwise.&lt;/p&gt;  &lt;h1&gt;Repeating characters&lt;/h1&gt;  &lt;p&gt;One of the more useful overrides of the String constructor is the ability to easily repeat any character a number of times. Here’s a brief example:&lt;/p&gt;  &lt;pre class="code"&gt;&lt;span style="color: blue"&gt;Dim &lt;/span&gt;horizontalRule &lt;span style="color: blue"&gt;As New String&lt;/span&gt;(&lt;span style="color: #a31515"&gt;"-"c&lt;/span&gt;, 100)
Console.WriteLine(horizontalRule)&lt;/pre&gt;

&lt;h1&gt;Subsections of Char arrays&lt;/h1&gt;

&lt;p&gt;If you’ve got a Char array you can grab a subsection by specifying a start point and a length:&lt;/p&gt;

&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;Dim &lt;/span&gt;catchyPhrase &lt;span style="color: blue"&gt;As Char&lt;/span&gt;() = &lt;span style="color: blue"&gt;CType&lt;/span&gt;(&lt;span style="color: #a31515"&gt;"Catch for us the foxes."&lt;/span&gt;, &lt;span style="color: blue"&gt;Char&lt;/span&gt;())
&lt;span style="color: blue"&gt;Dim &lt;/span&gt;phrasePart &lt;span style="color: blue"&gt;As New String&lt;/span&gt;(catchyPhrase, 0, 12)

Console.WriteLine(phrasePart)&lt;/pre&gt;

&lt;h1&gt;Other pointer based operations&lt;/h1&gt;

&lt;p&gt;There are a few more useful constructors if you are developing in C# or C++ that make use of arrays, but because Visual Basic doesn’t allow for the use of unsafe types I won’t go over them. You can check out the remaining constructors on the MSDN at the link below.&lt;/p&gt;

&lt;p&gt;There are many useful features in .NET that can be easily overlooked, but in the long run you might find something that would have otherwise saved you time.&lt;/p&gt;

&lt;p&gt;&lt;a title="http://msdn.microsoft.com/en-us/library/system.string.string.aspx" href="http://msdn.microsoft.com/en-us/library/system.string.string.aspx"&gt;http://msdn.microsoft.com/en-us/library/system.string.string.aspx&lt;/a&gt;&lt;/p&gt;

&lt;p&gt; &lt;/p&gt;

&lt;div class="wlWriterEditableSmartContent" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:d96494a0-1f21-47c6-a8a5-eb5077c317f7" style="padding-right: 0px; display: inline; padding-left: 0px; float: none; padding-bottom: 0px; margin: 0px; padding-top: 0px"&gt;Technorati Tags: &lt;a href="http://technorati.com/tags/VB.NET" rel="tag"&gt;VB.NET&lt;/a&gt;,&lt;a href="http://technorati.com/tags/String" rel="tag"&gt;String&lt;/a&gt;,&lt;a href="http://technorati.com/tags/MSDN" rel="tag"&gt;MSDN&lt;/a&gt;&lt;/div&gt;&lt;p&gt;&lt;a href="http://www.pheedo.com/click.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=131719"&gt;&lt;img src="http://www.pheedo.com/img.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=131719" border="0"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;iframe src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;PageID=31016&amp;amp;SiteID=1" width=1 height=1 Marginwidth=0 Marginheight=0 Hspace=0 Vspace=0 Frameborder=0 Scrolling=No&gt;
&lt;script language='javascript1.1' src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Browser=NETSCAPE4&amp;amp;NoCache=True&amp;PageID=31016&amp;amp;SiteID=1"&gt;&lt;/script&gt;
&lt;noscript&gt;&lt;a href="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Click&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" target="_blank"&gt;
&lt;img src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" width="1" height="1" border="0"  alt=""&gt;&lt;/a&gt;
&lt;/noscript&gt;
&lt;/iframe&gt;
&lt;img src="http://wtfnext.com/aggbug/131719.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Stacy Vicknair</dc:creator>
            <guid>http://wtfnext.com/archive/2009/05/04/.net-tip-using-string-constructors.aspx</guid>
            <pubDate>Mon, 04 May 2009 14:31:37 GMT</pubDate>
            <wfw:comment>http://wtfnext.com/comments/131719.aspx</wfw:comment>
            <comments>http://wtfnext.com/archive/2009/05/04/.net-tip-using-string-constructors.aspx#feedback</comments>
            <wfw:commentRss>http://wtfnext.com/comments/commentRss/131719.aspx</wfw:commentRss>
            <trackback:ping>http://wtfnext.com/services/trackbacks/131719.aspx</trackback:ping>
        </item>
        <item>
            <title>How NUnit and TDD helped me today</title>
            <link>http://wtfnext.com/archive/2009/03/11/how-nunit-and-tdd-helped-me-today.aspx</link>
            <description>&lt;p&gt;&lt;a href="http://geekswithblogs.net/images/geekswithblogs_net/WTFNext/WindowsLiveWriter/HowNUnitandTDDhelpedmetoday_E727/nunit_2.gif"&gt;&lt;img title="nunit" style="border-right: 0px; border-top: 0px; display: inline; margin: 0px 15px 0px 0px; border-left: 0px; border-bottom: 0px" height="71" alt="nunit" src="http://geekswithblogs.net/images/geekswithblogs_net/WTFNext/WindowsLiveWriter/HowNUnitandTDDhelpedmetoday_E727/nunit_thumb.gif" width="133" align="left" border="0" /&gt;&lt;/a&gt; My work environment is usually an anything goes, wild west of development sort of place. There are no rules imposed, just a “get things done” attitude. Because of auditing, source control was a necessity that got added to the mix. We use SVN through &lt;a href="http://www.visualsvn.com/server/"&gt;VisualSVN Server&lt;/a&gt; and &lt;a href="http://tortoisesvn.net/"&gt;TortoiseSVN&lt;/a&gt; as a client.&lt;/p&gt;  &lt;p&gt;Well, as a part of self improvement and to produce better more reliable code, I’ve taken up learning TDD for myself. Our current methodology of testing here is based mostly on &lt;a href="http://www.osnews.com/images/comics/wtfm.jpg"&gt;WTFs per minute&lt;/a&gt; and copious prayer. This time around, I’m trying super scoffable alternative: &lt;a href="http://en.wikipedia.org/wiki/Automated_testing"&gt;automated testing&lt;/a&gt; and &lt;a href="http://en.wikipedia.org/wiki/Continuous_integration"&gt;continuous integration&lt;/a&gt;. Tests &lt;strong&gt;&lt;em&gt;better&lt;/em&gt;&lt;/strong&gt; than no tests? &lt;em&gt;pshaw.&lt;/em&gt;&lt;/p&gt;  &lt;p&gt;So, when trying to read resources on &lt;a href="http://en.wikipedia.org/wiki/Test-driven_development"&gt;TDD&lt;/a&gt;, getting started always seemed difficult. I even tried the book TDD By Example to see if that would help, but it seemed sluggish to read along and try these minute tests that don’t apply to my real world applications. I started trying to integrate TDD in a small project for work instead.&lt;/p&gt;  &lt;p&gt;As a result, I can say I’m experiencing the benefits of TDD already. When I refactor or write new code, I’m confident that I’m doing it for a reason. If the tests fail, I know what exactly is failing and can isolate it. &lt;/p&gt;  &lt;p&gt;Today, while writing tests, I somehow created a never-ending loop in code (must’ve been evil code fairies I swear.) This gave me my first problem with my TDD experience: How do I debug code for a partially constructed application, when all I’ve got to go on is that I know it doesn’t work?&lt;/p&gt;  &lt;p&gt;Well, here’s what I was able to do.&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;Added a new console app project to the solution called Testing.Debug&lt;/li&gt;    &lt;li&gt;Extracted my unit test and put it as the sole code in the console app.&lt;/li&gt;    &lt;li&gt;Added a break point where I &lt;strong&gt;knew&lt;/strong&gt; my problem was happening.&lt;/li&gt; &lt;/ol&gt;  &lt;p&gt;I &lt;strong&gt;knew&lt;/strong&gt; the where, but I couldn’t discern the &lt;strong&gt;&lt;em&gt;what&lt;/em&gt;&lt;/strong&gt;. After running the small testing app I found it quickly and fixed the problem.&lt;/p&gt;  &lt;p&gt;So my question to those of you who do TDD often, how would you handle the situation? How do you handle situations that might call for a debugger?&lt;/p&gt;  &lt;p&gt; &lt;/p&gt;  &lt;div class="wlWriterEditableSmartContent" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:47251865-c5fe-4f02-b9ad-4dd469f540b7" style="padding-right: 0px; display: inline; padding-left: 0px; float: none; padding-bottom: 0px; margin: 0px; padding-top: 0px"&gt;Technorati Tags: &lt;a href="http://technorati.com/tags/TDD" rel="tag"&gt;TDD&lt;/a&gt;,&lt;a href="http://technorati.com/tags/NUnit" rel="tag"&gt;NUnit&lt;/a&gt;,&lt;a href="http://technorati.com/tags/SVN" rel="tag"&gt;SVN&lt;/a&gt;,&lt;a href="http://technorati.com/tags/debugging" rel="tag"&gt;debugging&lt;/a&gt;&lt;/div&gt;&lt;p&gt;&lt;a href="http://www.pheedo.com/click.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=130023"&gt;&lt;img src="http://www.pheedo.com/img.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=130023" border="0"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;iframe src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;PageID=31016&amp;amp;SiteID=1" width=1 height=1 Marginwidth=0 Marginheight=0 Hspace=0 Vspace=0 Frameborder=0 Scrolling=No&gt;
&lt;script language='javascript1.1' src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Browser=NETSCAPE4&amp;amp;NoCache=True&amp;PageID=31016&amp;amp;SiteID=1"&gt;&lt;/script&gt;
&lt;noscript&gt;&lt;a href="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Click&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" target="_blank"&gt;
&lt;img src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" width="1" height="1" border="0"  alt=""&gt;&lt;/a&gt;
&lt;/noscript&gt;
&lt;/iframe&gt;
&lt;img src="http://wtfnext.com/aggbug/130023.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Stacy Vicknair</dc:creator>
            <guid>http://wtfnext.com/archive/2009/03/11/how-nunit-and-tdd-helped-me-today.aspx</guid>
            <pubDate>Wed, 11 Mar 2009 21:26:14 GMT</pubDate>
            <wfw:comment>http://wtfnext.com/comments/130023.aspx</wfw:comment>
            <comments>http://wtfnext.com/archive/2009/03/11/how-nunit-and-tdd-helped-me-today.aspx#feedback</comments>
            <slash:comments>2</slash:comments>
            <wfw:commentRss>http://wtfnext.com/comments/commentRss/130023.aspx</wfw:commentRss>
            <trackback:ping>http://wtfnext.com/services/trackbacks/130023.aspx</trackback:ping>
        </item>
        <item>
            <title>Head First Design Patterns &amp;ndash; VB.NET code examples on CodePlex</title>
            <link>http://wtfnext.com/archive/2009/01/30/head-first-design-patterns-ndash-vb.net-code-examples-on-codeplex.aspx</link>
            <description>&lt;p&gt;For those of you looking to get started with design patterns but reluctant because of language barriers, I started a project on CodePlex for the &lt;a href="http://www.amazon.com/gp/product/0596007124?ie=UTF8&amp;amp;tag=w0dbc-20&amp;amp;linkCode=as2&amp;amp;camp=1789&amp;amp;creative=390957&amp;amp;creativeASIN=0596007124"&gt;Head First Design Patterns&lt;/a&gt;&lt;img style="margin: 0px; border-top-style: none! important; border-right-style: none! important; border-left-style: none! important; border-bottom-style: none! important" height="1" alt="" src="http://www.assoc-amazon.com/e/ir?t=w0dbc-20&amp;amp;l=as2&amp;amp;o=1&amp;amp;a=0596007124" width="1" border="0" /&gt; book. The original code examples are in Java, and they have been made available in C# and C++ as well, which are all available on the book’s online page, &lt;a title="http://www.headfirstlabs.com/books/hfdp/" href="http://www.headfirstlabs.com/books/hfdp/"&gt;http://www.headfirstlabs.com/books/hfdp/&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt; &lt;/p&gt;  &lt;p&gt;Currently the project is only Chapters 1-8, but pending the big game on Sunday I will be finished up sometime next week. This is one of my first CodePlex contributions, so any helpful hints or suggestions would be much appreciated. Otherwise, go ahead and get the source and start looking into design patterns. I definitely recommend getting the book and definitely check out the entire &lt;a href="http://www.amazon.com/gp/redirect.html?ie=UTF8&amp;amp;location=http%3A%2F%2Fwww.amazon.com%2Fgp%2Fseries%2F93629%3Fie%3DUTF8%26ref%255F%3Ds9%255Fkser%255Ft1%255Fser&amp;amp;tag=w0dbc-20&amp;amp;linkCode=ur2&amp;amp;camp=1789&amp;amp;creative=390957"&gt;Head First series&lt;/a&gt;&lt;img style="margin: 0px; border-top-style: none! important; border-right-style: none! important; border-left-style: none! important; border-bottom-style: none! important" height="1" alt="" src="https://www.assoc-amazon.com/e/ir?t=w0dbc-20&amp;amp;l=ur2&amp;amp;o=1" width="1" border="0" /&gt;!&lt;/p&gt;  &lt;p&gt; &lt;/p&gt;  &lt;p&gt;Get the VB.NET code examples here:    &lt;br /&gt;&lt;a title="http://www.codeplex.com/HFDPinVB/" href="http://www.codeplex.com/HFDPinVB/"&gt;http://www.codeplex.com/HFDPinVB/&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Get more info on all the Head First books:    &lt;br /&gt;&lt;a title="http://www.headfirstlabs.com/" href="http://www.headfirstlabs.com/"&gt;http://www.headfirstlabs.com/&lt;/a&gt;&lt;/p&gt;  &lt;p&gt; &lt;/p&gt;  &lt;div class="wlWriterEditableSmartContent" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:76910215-cf38-4383-b1b7-eab3545570d8" style="padding-right: 0px; display: inline; padding-left: 0px; float: none; padding-bottom: 0px; margin: 0px; padding-top: 0px"&gt;Technorati Tags: &lt;a href="http://technorati.com/tags/VB.NET" rel="tag"&gt;VB.NET&lt;/a&gt;,&lt;a href="http://technorati.com/tags/Head+First+Design+Patterns" rel="tag"&gt;Head First Design Patterns&lt;/a&gt;,&lt;a href="http://technorati.com/tags/Code+Examples" rel="tag"&gt;Code Examples&lt;/a&gt;&lt;/div&gt;&lt;p&gt;&lt;a href="http://www.pheedo.com/click.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=129097"&gt;&lt;img src="http://www.pheedo.com/img.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=129097" border="0"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;iframe src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;PageID=31016&amp;amp;SiteID=1" width=1 height=1 Marginwidth=0 Marginheight=0 Hspace=0 Vspace=0 Frameborder=0 Scrolling=No&gt;
&lt;script language='javascript1.1' src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Browser=NETSCAPE4&amp;amp;NoCache=True&amp;PageID=31016&amp;amp;SiteID=1"&gt;&lt;/script&gt;
&lt;noscript&gt;&lt;a href="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Click&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" target="_blank"&gt;
&lt;img src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" width="1" height="1" border="0"  alt=""&gt;&lt;/a&gt;
&lt;/noscript&gt;
&lt;/iframe&gt;
&lt;img src="http://wtfnext.com/aggbug/129097.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Stacy Vicknair</dc:creator>
            <guid>http://wtfnext.com/archive/2009/01/30/head-first-design-patterns-ndash-vb.net-code-examples-on-codeplex.aspx</guid>
            <pubDate>Fri, 30 Jan 2009 16:24:09 GMT</pubDate>
            <wfw:comment>http://wtfnext.com/comments/129097.aspx</wfw:comment>
            <comments>http://wtfnext.com/archive/2009/01/30/head-first-design-patterns-ndash-vb.net-code-examples-on-codeplex.aspx#feedback</comments>
            <slash:comments>2</slash:comments>
            <wfw:commentRss>http://wtfnext.com/comments/commentRss/129097.aspx</wfw:commentRss>
            <trackback:ping>http://wtfnext.com/services/trackbacks/129097.aspx</trackback:ping>
        </item>
        <item>
            <title>Passing the 070-536 Revisited</title>
            <link>http://wtfnext.com/archive/2009/01/20/passing-the-070-536-revisited.aspx</link>
            <description>&lt;p&gt;So, yesterday I passed the 070-536, and I wanted to revisit my list of helpful insights. I wanted to add a couple new insights to the mix in particular. Here are the additional insights, and these will probably remain steadfast for all .NET exams:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Go in with a deep understanding of core operations. If something is often used or is referenced in the training kit, get a really good grip on it.&lt;/li&gt;    &lt;li&gt;Isolate the differences in each answer. Look at what could be wrong, and use your best judgment.&lt;/li&gt;    &lt;li&gt;Finally, remember that .NET is meant to help tasks be easy to code! Sometimes the easiest solution really is the right solution.&lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;I hope that these vague tips can help you, because they touch on the core knowledge when it comes to testing. Be good at .NET and know the subject, but also don’t panic and be a good tester.&lt;/p&gt;  &lt;p&gt; &lt;/p&gt;  &lt;p&gt;The old blog was posted at this link:&lt;/p&gt;  &lt;p&gt;&lt;a title="Click To View Entry" href="http://www.wtfnext.com/archive/2008/12/19/microsoft-exam-070-536-how-ive-prepared.aspx"&gt;Click To View Entry&lt;/a&gt;&lt;/p&gt;  &lt;p&gt; &lt;/p&gt;  &lt;div class="wlWriterEditableSmartContent" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:daf36200-efae-45e2-8be9-2bd227e2dc24" style="padding-right: 0px; display: inline; padding-left: 0px; float: none; padding-bottom: 0px; margin: 0px; padding-top: 0px"&gt;Technorati Tags: &lt;a href="http://technorati.com/tags/070-536" rel="tag"&gt;070-536&lt;/a&gt;,&lt;a href="http://technorati.com/tags/Microsoft+Certification" rel="tag"&gt;Microsoft Certification&lt;/a&gt;&lt;/div&gt;&lt;p&gt;&lt;a href="http://www.pheedo.com/click.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=128814"&gt;&lt;img src="http://www.pheedo.com/img.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=128814" border="0"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;iframe src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;PageID=31016&amp;amp;SiteID=1" width=1 height=1 Marginwidth=0 Marginheight=0 Hspace=0 Vspace=0 Frameborder=0 Scrolling=No&gt;
&lt;script language='javascript1.1' src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Browser=NETSCAPE4&amp;amp;NoCache=True&amp;PageID=31016&amp;amp;SiteID=1"&gt;&lt;/script&gt;
&lt;noscript&gt;&lt;a href="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Click&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" target="_blank"&gt;
&lt;img src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" width="1" height="1" border="0"  alt=""&gt;&lt;/a&gt;
&lt;/noscript&gt;
&lt;/iframe&gt;
&lt;img src="http://wtfnext.com/aggbug/128814.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Stacy Vicknair</dc:creator>
            <guid>http://wtfnext.com/archive/2009/01/20/passing-the-070-536-revisited.aspx</guid>
            <pubDate>Tue, 20 Jan 2009 15:27:39 GMT</pubDate>
            <wfw:comment>http://wtfnext.com/comments/128814.aspx</wfw:comment>
            <comments>http://wtfnext.com/archive/2009/01/20/passing-the-070-536-revisited.aspx#feedback</comments>
            <wfw:commentRss>http://wtfnext.com/comments/commentRss/128814.aspx</wfw:commentRss>
            <trackback:ping>http://wtfnext.com/services/trackbacks/128814.aspx</trackback:ping>
        </item>
        <item>
            <title>Looking at regular expressions, behind and ahead.</title>
            <link>http://wtfnext.com/archive/2009/01/17/looking-at-regular-expressions-behind-and-ahead.aspx</link>
            <description>&lt;p&gt;This post is mostly inspired by &lt;a href="http://social.msdn.microsoft.com/Forums/en-US/regexp/thread/7370cc2a-ea37-46e6-9241-4dc6ba7c2ea0" target="_blank"&gt;a question I came across in the MSDN forums&lt;/a&gt;. Basically, say we had a set of data in a string that looked something like this and we just HAAAAAD to use regular expressions to get the info out (I’m insinuating maybe string.split would work better in this situation…)&lt;/p&gt;  &lt;pre class="code"&gt;&lt;span style="color: blue"&gt;Dim &lt;/span&gt;dataToSearch &lt;span style="color: blue"&gt;As String &lt;/span&gt;= &lt;span style="color: #a31515"&gt;"-Cat-Dog-Meese-Chardonnay-"&lt;/span&gt;&lt;/pre&gt;

&lt;p&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;Well, the pattern is simple right? Just throw in a regex for "-[A-Za-z]+-" and we’re good to go. &lt;/p&gt;

&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;Dim &lt;/span&gt;reg &lt;span style="color: blue"&gt;As New &lt;/span&gt;Regex(&lt;span style="color: #a31515"&gt;"-[A-Za-z]+-"&lt;/span&gt;)

&lt;span style="color: blue"&gt;For Each &lt;/span&gt;m &lt;span style="color: blue"&gt;As &lt;/span&gt;Match &lt;span style="color: blue"&gt;In &lt;/span&gt;reg.Matches(dataToSearch)
    Console.WriteLine(m.Value)
&lt;span style="color: blue"&gt;Next&lt;/span&gt;&lt;/pre&gt;
&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;

&lt;p&gt;However, we get this.&lt;/p&gt;

&lt;p&gt;&lt;a href="http://geekswithblogs.net/images/geekswithblogs_net/WTFNext/WindowsLiveWriter/Lookingatregularexpressionsbehindandahe_B195/image_2.png"&gt;&lt;img title="image" style="border-right: 0px; border-top: 0px; display: inline; border-left: 0px; border-bottom: 0px" height="142" alt="image" src="http://geekswithblogs.net/images/geekswithblogs_net/WTFNext/WindowsLiveWriter/Lookingatregularexpressionsbehindandahe_B195/image_thumb.png" width="244" border="0" /&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;So what happened? Well, The regex doesn’t catch overlapping results, so we’re just left with our &lt;strong&gt;Cat&lt;/strong&gt; and &lt;strong&gt;Meese&lt;/strong&gt; (the obvious plural of mice). Is there something we can do in this case? Yep. This is where we start &lt;strong&gt;looking around&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;In regular expressions, just like crossing the street, you can look both ways (although for crossing the street, you ought to. You might not need to for RegEx). &lt;strong&gt;Looking ahead &lt;/strong&gt;is like trying to peek around traffic when the interstates stops. You know what you are doing, but you need to know what’s happening further down the line that might influence you.&lt;/p&gt;

&lt;p&gt;So, if we want to look ahead from our first term without actually consuming the dash, this will allow us something like this:&lt;/p&gt;

&lt;p&gt; &lt;/p&gt;

&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;Dim &lt;/span&gt;dataToSearch &lt;span style="color: blue"&gt;As String &lt;/span&gt;= &lt;span style="color: #a31515"&gt;"-Cat-Dog-Meese-Chardonnay-"

&lt;/span&gt;&lt;span style="color: blue"&gt;Dim &lt;/span&gt;reg &lt;span style="color: blue"&gt;As New &lt;/span&gt;Regex(&lt;span style="color: #a31515"&gt;"-[A-Za-z]+(?=-)"&lt;/span&gt;)

&lt;span style="color: blue"&gt;For Each &lt;/span&gt;m &lt;span style="color: blue"&gt;As &lt;/span&gt;Match &lt;span style="color: blue"&gt;In &lt;/span&gt;reg.Matches(dataToSearch)
    Console.WriteLine(m.Value)
&lt;span style="color: blue"&gt;Next
&lt;/span&gt;Console.ReadLine()&lt;/pre&gt;

&lt;p&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;And our result becomes:&lt;/p&gt;

&lt;p&gt;&lt;a href="http://geekswithblogs.net/images/geekswithblogs_net/WTFNext/WindowsLiveWriter/Lookingatregularexpressionsbehindandahe_B195/image_4.png"&gt;&lt;img title="image" style="border-right: 0px; border-top: 0px; display: inline; border-left: 0px; border-bottom: 0px" height="150" alt="image" src="http://geekswithblogs.net/images/geekswithblogs_net/WTFNext/WindowsLiveWriter/Lookingatregularexpressionsbehindandahe_B195/image_thumb_1.png" width="244" border="0" /&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;Hoorah! We’ve got all the terms now. So let’s look at what we’ve changed. Instead of just a dash after our &lt;strong&gt;[A-Za-z]&lt;/strong&gt; now we’ve got &lt;strong&gt;(?=-)&lt;/strong&gt;. What this is saying is that we don’t want to consume this value, but our regex ought to have a dash afterwards. Say we wanted to work this differently and instead say we want to end on any non &lt;strong&gt;[A-Za-z]&lt;/strong&gt; instead we could do &lt;strong&gt;(?![A-Za-z])&lt;/strong&gt; and we’d get the same result. This is a &lt;strong&gt;negative lookahead&lt;/strong&gt;, and is simply just looking for what we don’t want to find instead of what we do.&lt;/p&gt;

&lt;p&gt;Well, what about that first dash? I don’t really care for it either, so let’s look and a &lt;strong&gt;look behind&lt;/strong&gt; to get rid of it. Keeping with our example, you might compare this to looking in the rearview mirror to make sure you aren’t being followed.&lt;/p&gt;

&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;Dim &lt;/span&gt;dataToSearch &lt;span style="color: blue"&gt;As String &lt;/span&gt;= &lt;span style="color: #a31515"&gt;"-Cat-Dog-Meese-Chardonnay-"

&lt;/span&gt;&lt;span style="color: blue"&gt;Dim &lt;/span&gt;reg &lt;span style="color: blue"&gt;As New &lt;/span&gt;Regex(&lt;span style="color: #a31515"&gt;"(?&amp;lt;=-)[A-Za-z]+(?=-)"&lt;/span&gt;)

&lt;span style="color: blue"&gt;For Each &lt;/span&gt;m &lt;span style="color: blue"&gt;As &lt;/span&gt;Match &lt;span style="color: blue"&gt;In &lt;/span&gt;reg.Matches(dataToSearch)
    Console.WriteLine(m.Value)
&lt;span style="color: blue"&gt;Next
&lt;/span&gt;Console.ReadLine()&lt;/pre&gt;

&lt;p&gt;Now our results are nice and clean (except maybe the dog and our chardonnay that is in mixed company…)&lt;/p&gt;

&lt;p&gt;&lt;a href="http://geekswithblogs.net/images/geekswithblogs_net/WTFNext/WindowsLiveWriter/Lookingatregularexpressionsbehindandahe_B195/image_6.png"&gt;&lt;img title="image" style="border-right: 0px; border-top: 0px; display: inline; border-left: 0px; border-bottom: 0px" height="135" alt="image" src="http://geekswithblogs.net/images/geekswithblogs_net/WTFNext/WindowsLiveWriter/Lookingatregularexpressionsbehindandahe_B195/image_thumb_2.png" width="244" border="0" /&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;So what is different about a &lt;strong&gt;look behind&lt;/strong&gt;? Now, we’re looking at what comes before our area of interest. And since we aren’t consuming it, just saying that the dash better be there, it isn’t a part of the result!&lt;/p&gt;

&lt;p&gt;On a similar note to looking ahead, we can also do a &lt;strong&gt;negative lookbehind&lt;/strong&gt; by using &lt;strong&gt;(?&amp;lt;![A-Za-z])&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt; &lt;/p&gt;

&lt;p&gt;So that concludes our quick look at regular expressions, from all angles. I hope you found these examples enjoyable, and for more information be sure to check out these helpful links:&lt;/p&gt;

&lt;p&gt;&lt;a title="http://www.regular-expressions.info/lookaround.html" href="http://www.regular-expressions.info/lookaround.html"&gt;http://www.regular-expressions.info/lookaround.html&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a title="http://social.msdn.microsoft.com/Forums/en-US/regexp/threads/" href="http://social.msdn.microsoft.com/Forums/en-US/regexp/threads/"&gt;http://social.msdn.microsoft.com/Forums/en-US/regexp/threads/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt; &lt;/p&gt;

&lt;div class="wlWriterEditableSmartContent" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:d9089f0e-43e1-4efc-bb57-c684b9de3916" style="padding-right: 0px; display: inline; padding-left: 0px; float: none; padding-bottom: 0px; margin: 0px; padding-top: 0px"&gt;Technorati Tags: &lt;a href="http://technorati.com/tags/Regular+Expressions" rel="tag"&gt;Regular Expressions&lt;/a&gt;,&lt;a href="http://technorati.com/tags/VB.NET" rel="tag"&gt;VB.NET&lt;/a&gt;&lt;/div&gt;&lt;p&gt;&lt;a href="http://www.pheedo.com/click.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=128755"&gt;&lt;img src="http://www.pheedo.com/img.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=128755" border="0"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;iframe src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;PageID=31016&amp;amp;SiteID=1" width=1 height=1 Marginwidth=0 Marginheight=0 Hspace=0 Vspace=0 Frameborder=0 Scrolling=No&gt;
&lt;script language='javascript1.1' src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Browser=NETSCAPE4&amp;amp;NoCache=True&amp;PageID=31016&amp;amp;SiteID=1"&gt;&lt;/script&gt;
&lt;noscript&gt;&lt;a href="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Click&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" target="_blank"&gt;
&lt;img src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" width="1" height="1" border="0"  alt=""&gt;&lt;/a&gt;
&lt;/noscript&gt;
&lt;/iframe&gt;
&lt;img src="http://wtfnext.com/aggbug/128755.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Stacy Vicknair</dc:creator>
            <guid>http://wtfnext.com/archive/2009/01/17/looking-at-regular-expressions-behind-and-ahead.aspx</guid>
            <pubDate>Sat, 17 Jan 2009 18:37:44 GMT</pubDate>
            <wfw:comment>http://wtfnext.com/comments/128755.aspx</wfw:comment>
            <comments>http://wtfnext.com/archive/2009/01/17/looking-at-regular-expressions-behind-and-ahead.aspx#feedback</comments>
            <wfw:commentRss>http://wtfnext.com/comments/commentRss/128755.aspx</wfw:commentRss>
            <trackback:ping>http://wtfnext.com/services/trackbacks/128755.aspx</trackback:ping>
        </item>
        <item>
            <title>WindowsClient.NET How Do I Videos for WinForms</title>
            <link>http://wtfnext.com/archive/2009/01/02/windowsclient.net-how-do-i-videos-for-winforms.aspx</link>
            <description>&lt;p&gt;As you may know, I do mostly WinForms development at my current position. Altogether, I do have an affinity for WinForms development over web development, mostly because simple websites were easy to make when I was young, but making a windows application was something I didn't do until much later on.&lt;/p&gt;  &lt;p&gt;Well, &lt;a href="http://windowsclient.net/"&gt;WindowsClient.net&lt;/a&gt; is a great Microsoft resource for those interested specifically in smart client applications, and the even better news is that the bulk of the videos for WinForms in particular are done by Pat Torney of &lt;a href="http://www.4square.net/"&gt;FourSquare Solutions Inc&lt;/a&gt; and in VB.NET!&lt;/p&gt;  &lt;p&gt;To be honest, one of the major frustrations I have with beginner's programming books is that they almost never talk about deployment. They will let you be dazzled by how easy your first XYZ app was to make, but then they never let you know how you can email a setup to grandma and have it work out just fine.&lt;/p&gt;  &lt;p&gt;Thankfully, Pat's got you covered with the &lt;a href="http://windowsclient.net/learn/video.aspx?v=14636"&gt;How Do I: SmartClient Deployment&lt;/a&gt; video. I really cannot express how thankful I am to now have an easy to reference video that I can tell others to check out when they get started with VB and want to deploy their masterpiece in an installer instead of ClickOnce.&lt;/p&gt;  &lt;p&gt;I've been perusing the videos and I'm thankful for Pat's work. He also includes helpful hints along the way and keeps it interesting with a bit of humor.&lt;/p&gt;  &lt;p&gt;SmartClient Deployment:   &lt;br /&gt;&lt;a title="http://windowsclient.net/learn/video.aspx?v=14636" href="http://windowsclient.net/learn/video.aspx?v=14636"&gt;http://windowsclient.net/learn/video.aspx?v=14636&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;All the WindowsClient.net videos:   &lt;br /&gt;&lt;a title="http://windowsclient.net/learn/" href="http://windowsclient.net/learn/"&gt;http://windowsclient.net/learn/&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Also, you might find the full VB.NET learning library a good investment:   &lt;br /&gt;&lt;a title="http://msdn.microsoft.com/en-us/vbasic/ms789086.aspx" href="http://msdn.microsoft.com/en-us/vbasic/ms789086.aspx"&gt;http://msdn.microsoft.com/en-us/vbasic/ms789086.aspx&lt;/a&gt;&lt;/p&gt;  &lt;p&gt; &lt;/p&gt;  &lt;div class="wlWriterSmartContent" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:ac8aa716-d5b6-4bea-a2cc-900b38a47713" style="padding-right: 0px; display: inline; padding-left: 0px; padding-bottom: 0px; margin: 0px; padding-top: 0px"&gt;Technorati Tags: &lt;a href="http://technorati.com/tags/WinForms" rel="tag"&gt;WinForms&lt;/a&gt;,&lt;a href="http://technorati.com/tags/Windows%20Client" rel="tag"&gt;Windows Client&lt;/a&gt;,&lt;a href="http://technorati.com/tags/Deployment" rel="tag"&gt;Deployment&lt;/a&gt;&lt;/div&gt;&lt;p&gt;&lt;a href="http://www.pheedo.com/click.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=128314"&gt;&lt;img src="http://www.pheedo.com/img.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=128314" border="0"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;iframe src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;PageID=31016&amp;amp;SiteID=1" width=1 height=1 Marginwidth=0 Marginheight=0 Hspace=0 Vspace=0 Frameborder=0 Scrolling=No&gt;
&lt;script language='javascript1.1' src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Browser=NETSCAPE4&amp;amp;NoCache=True&amp;PageID=31016&amp;amp;SiteID=1"&gt;&lt;/script&gt;
&lt;noscript&gt;&lt;a href="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Click&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" target="_blank"&gt;
&lt;img src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" width="1" height="1" border="0"  alt=""&gt;&lt;/a&gt;
&lt;/noscript&gt;
&lt;/iframe&gt;
&lt;img src="http://wtfnext.com/aggbug/128314.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Stacy Vicknair</dc:creator>
            <guid>http://wtfnext.com/archive/2009/01/02/windowsclient.net-how-do-i-videos-for-winforms.aspx</guid>
            <pubDate>Fri, 02 Jan 2009 21:19:45 GMT</pubDate>
            <wfw:comment>http://wtfnext.com/comments/128314.aspx</wfw:comment>
            <comments>http://wtfnext.com/archive/2009/01/02/windowsclient.net-how-do-i-videos-for-winforms.aspx#feedback</comments>
            <wfw:commentRss>http://wtfnext.com/comments/commentRss/128314.aspx</wfw:commentRss>
            <trackback:ping>http://wtfnext.com/services/trackbacks/128314.aspx</trackback:ping>
        </item>
        <item>
            <title>Free VB Coding Standards Reference Document</title>
            <link>http://wtfnext.com/archive/2008/12/22/free-vb-coding-standards-reference-document-again.aspx</link>
            <description>&lt;p&gt;Clint Edmonson over at &lt;a href="http://www.notsotrivial.net"&gt;http://www.notsotrivial.net&lt;/a&gt; put together a collection of language specific coding standards reference documentation. This is a great starting point for your organization or a good resource to evaluate your current standards.&lt;/p&gt;  &lt;p&gt;View the article and get the goods here:&lt;/p&gt;  &lt;p&gt;&lt;a title="http://www.notsotrivial.net/blog/post/2008/12/Holiday-Goodie-Bag-Free-C-and-VB-Coding-Standards-Reference-Documents.aspx" href="http://www.notsotrivial.net/blog/post/2008/12/Holiday-Goodie-Bag-Free-C-and-VB-Coding-Standards-Reference-Documents.aspx"&gt;http://www.notsotrivial.net/blog/post/2008/12/Holiday-Goodie-Bag-Free-C-and-VB-Coding-Standards-Reference-Documents.aspx&lt;/a&gt;&lt;/p&gt;  &lt;p&gt; &lt;/p&gt;  &lt;div class="wlWriterSmartContent" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:59df388e-47d3-4e38-a522-263c386194f3" style="padding-right: 0px; display: inline; padding-left: 0px; padding-bottom: 0px; margin: 0px; padding-top: 0px"&gt;Technorati Tags: &lt;a href="http://technorati.com/tags/coding%20standards" rel="tag"&gt;coding standards&lt;/a&gt;,&lt;a href="http://technorati.com/tags/VB.NET" rel="tag"&gt;VB.NET&lt;/a&gt;,&lt;a href="http://technorati.com/tags/C#.NET" rel="tag"&gt;C#.NET&lt;/a&gt;&lt;/div&gt;&lt;p&gt;&lt;a href="http://www.pheedo.com/click.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=128111"&gt;&lt;img src="http://www.pheedo.com/img.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=128111" border="0"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;iframe src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;PageID=31016&amp;amp;SiteID=1" width=1 height=1 Marginwidth=0 Marginheight=0 Hspace=0 Vspace=0 Frameborder=0 Scrolling=No&gt;
&lt;script language='javascript1.1' src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Browser=NETSCAPE4&amp;amp;NoCache=True&amp;PageID=31016&amp;amp;SiteID=1"&gt;&lt;/script&gt;
&lt;noscript&gt;&lt;a href="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Click&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" target="_blank"&gt;
&lt;img src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" width="1" height="1" border="0"  alt=""&gt;&lt;/a&gt;
&lt;/noscript&gt;
&lt;/iframe&gt;
&lt;img src="http://wtfnext.com/aggbug/128111.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Stacy Vicknair</dc:creator>
            <guid>http://wtfnext.com/archive/2008/12/22/free-vb-coding-standards-reference-document-again.aspx</guid>
            <pubDate>Mon, 22 Dec 2008 20:46:59 GMT</pubDate>
            <wfw:comment>http://wtfnext.com/comments/128111.aspx</wfw:comment>
            <comments>http://wtfnext.com/archive/2008/12/22/free-vb-coding-standards-reference-document-again.aspx#feedback</comments>
            <slash:comments>1</slash:comments>
            <wfw:commentRss>http://wtfnext.com/comments/commentRss/128111.aspx</wfw:commentRss>
            <trackback:ping>http://wtfnext.com/services/trackbacks/128111.aspx</trackback:ping>
        </item>
    </channel>
</rss>