<?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>Geek Rant dot org &#187; VB</title>
	<atom:link href="http://www.geekrant.org/category/code/vb/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.geekrant.org</link>
	<description></description>
	<lastBuildDate>Fri, 20 Jan 2012 07:30:04 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>How to do null dates in database queries in VB.Net</title>
		<link>http://www.geekrant.org/2007/09/25/vb-net-null-dates/</link>
		<comments>http://www.geekrant.org/2007/09/25/vb-net-null-dates/#comments</comments>
		<pubDate>Tue, 25 Sep 2007 11:49:52 +0000</pubDate>
		<dc:creator>daniel</dc:creator>
				<category><![CDATA[Dot Net]]></category>
		<category><![CDATA[VB]]></category>

		<guid isPermaLink="false">http://www.geekrant.org/2007/09/25/vb-net-null-dates/</guid>
		<description><![CDATA[They do make you jump through some hoops, but I think I&#8217;ve got it worked out. Dim dYourDateField As Nullable(Of Date) &#8230;then you either set it to be a date (using DateSerial or CDate or whatever, or you set it to Nothing. Then when you&#8217;re using it in a database query, the parameter can be [...]]]></description>
			<content:encoded><![CDATA[<p>They do make you jump through some hoops, but I think I&#8217;ve got it worked out.</p>
<p>Dim dYourDateField As Nullable(Of Date)</p>
<p>&#8230;then you either set it to be a date (using DateSerial or CDate or whatever, or you set it to Nothing.</p>
<p>Then when you&#8217;re using it in a database query, the parameter can be set like this:</p>
<p>oCmd.Parameters.Add(&#8220;@YourDateField&#8221;, System.Data.OleDb.OleDbType.DBDate).Value = dYourDateField</p>
<p>That&#8217;s it. At least, it seems to work okay for me. Touch wood. Apparently it should be okay in the .Net Framework 2 onwards.</p>
<p>[Another in an occasional series of things Daniel posts about so he can easily re-discover it next time he needs to remember how it's done.]</p>
]]></content:encoded>
			<wfw:commentRss>http://www.geekrant.org/2007/09/25/vb-net-null-dates/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Cool XML stuff</title>
		<link>http://www.geekrant.org/2007/01/15/cool-xml-stuff/</link>
		<comments>http://www.geekrant.org/2007/01/15/cool-xml-stuff/#comments</comments>
		<pubDate>Mon, 15 Jan 2007 10:51:15 +0000</pubDate>
		<dc:creator>daniel</dc:creator>
				<category><![CDATA[VB]]></category>
		<category><![CDATA[XML]]></category>

		<guid isPermaLink="false">http://www.geekrant.org/2007/01/15/cool-xml-stuff/</guid>
		<description><![CDATA[A bunch of XML Tools from the good people at Got Dot Net. The particular one I needed was XSD Inference, which creates an XSD from an XML document. I needed it to use with some code to validate XML against XSDs in VB6. It seems XSDs created from XML with some tools (I&#8217;m looking [...]]]></description>
			<content:encoded><![CDATA[<p>A bunch of <a href="http://www.gotdotnet.com/team/xmltools/">XML Tools</a> from the good people at Got Dot Net. The particular one I needed was XSD Inference, which creates an XSD from an XML document. I needed it to use with some <a href="http://www.nonhostile.com/page000009.asp">code to validate XML against XSDs in VB6</a>. It seems XSDs created from XML with some tools (I&#8217;m looking at you, XMLSpy &#8212; though maybe it&#8217;s fixed in later versions) won&#8217;t work properly using VB6/XML Parser 4 (which is what I&#8217;m using, at least for some of my stuff).</p>
]]></content:encoded>
			<wfw:commentRss>http://www.geekrant.org/2007/01/15/cool-xml-stuff/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Misc stuff</title>
		<link>http://www.geekrant.org/2006/10/16/misc-stuff/</link>
		<comments>http://www.geekrant.org/2006/10/16/misc-stuff/#comments</comments>
		<pubDate>Sun, 15 Oct 2006 22:16:25 +0000</pubDate>
		<dc:creator>daniel</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[TV]]></category>
		<category><![CDATA[VB]]></category>
		<category><![CDATA[XML]]></category>

		<guid isPermaLink="false">http://www.geekrant.org/2006/10/16/misc-stuff/</guid>
		<description><![CDATA[Cool links I&#8217;ve found recently: Super (MOV to AVI conversion). VB to Java converter. That is, it compiles VB6 code into a Java class. Latest update here. Q+A. (No, you can&#8217;t download it yet, they&#8217;re still working on it.) Oh, guess who&#8217;s on about giving away Digital set top boxes again? Yup. I do like [...]]]></description>
			<content:encoded><![CDATA[<p>Cool links I&#8217;ve found recently:</p>
<p><a href="http://www.erightsoft.com/S7f01.html">Super</a> (MOV to AVI conversion).</p>
<p><a href="http://blogs.sun.com/herbertc/entry/project_semplice_visual_basic_for">VB to Java converter</a>. That is, it compiles VB6 code into a Java class. <a href="http://blogs.sun.com/herbertc/entry/project_semplice_update">Latest update here</a>. <a href="http://blogs.sun.com/herbertc/entry/project_semplice_q_a">Q+A</a>. (No, you can&#8217;t download it yet, they&#8217;re still working on it.)</p>
<p>Oh, guess who&#8217;s on about <a href="http://www.theage.com.au/news/business/canberra-needs-to-switch-channels-to-give-all-a-clearer-picture-ofdigital-tv/2006/10/12/1160246263063.html?page=fullpage">giving away Digital set top boxes again? Yup.</a> I do like this argument, actually: <em>It is not the Government&#8217;s job to champion new technology. It is the Government&#8217;s job to provide universal infrastructure and manage the task in a financially responsible way.</em></p>
<p><a href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnxmlnet/html/xmlnotepad.asp">XML Notepad</a>, which after a looooong time not being available, is back, and upgraded. (Requires the <a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=0856eacb-4362-4b0d-8edd-aab15c5e04f5&#038;displaylang=en">.Net Framework 2</a>).</p>
]]></content:encoded>
			<wfw:commentRss>http://www.geekrant.org/2006/10/16/misc-stuff/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Calling COM from .Net, and vice versa</title>
		<link>http://www.geekrant.org/2006/07/26/calling-com-dotnet/</link>
		<comments>http://www.geekrant.org/2006/07/26/calling-com-dotnet/#comments</comments>
		<pubDate>Wed, 26 Jul 2006 11:44:26 +0000</pubDate>
		<dc:creator>daniel</dc:creator>
				<category><![CDATA[ASP]]></category>
		<category><![CDATA[Dot Net]]></category>
		<category><![CDATA[VB]]></category>

		<guid isPermaLink="false">http://www.geekrant.org/?p=770</guid>
		<description><![CDATA[I&#8217;m working on a project that uses web services code written in .Net (&#8216;cos it&#8217;s heaps easier that way) but calls legacy code written in VB6. And vice versa. (Wow, I never thought I&#8217;d be referring to VB6 code as legacy, but there you go. None of your smart comments, any VB-haters out there.) Here&#8217;s [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m working on a project that uses web services code written in .Net (&#8216;cos it&#8217;s heaps easier that way) but calls legacy code written in VB6. And vice versa.</p>
<p>(Wow, I never thought I&#8217;d be referring to VB6 code as legacy, but there you go. None of your smart comments, any VB-haters out there.)</p>
<p>Here&#8217;s what I&#8217;ve discovered about making it work.<span id="more-770"></span></p>
<h3>How to make .Net DLLs visible to COM/VB6</h3>
<p>In your .Net project</p>
<ul>
<li>Project settings; Assembly information; switch on &#8220;Make assembly COM-visible&#8221;</li>
<li>Watch out for the variables you use. VB.Net Longs can&#8217;t be used in VB6, for instance.</li>
<li>Build it</li>
<li>regasm.exe path\whatever.dll /tlb /codebase /verbose</li>
</ul>
<ul>
<li>/tlb tells it to produce a TLB file, which VB6 can talk to</li>
<li>/codebase makes it work for assmemblies other than in the <a href=" http://msdn.microsoft.com/library/en-us/cpguide/html/cpconglobalassemblycache.asp">Global Assembly Cache</a></li>
<li>/verbose because you want to see all the grisly details, right?</li>
<li>You&#8217;ll get a warning if your Assembly (DLL) isn&#8217;t strongly named. This involves name/version uniqueness, a digital signature and certificate. <a href="http://msdn.microsoft.com/library/en-us/cpguide/html/cpconStrong-NamedAssemblies.asp">More details here</a>. Ah, the lengths we must go through to avoid DLL hell.</li>
<li>Do a regasm.exe /unregister if you need to later</li>
</ul>
<p>In your creaking old VB6 project</p>
<ul>
<li>Add the reference to your whatever.tlb</li>
<li>Call that sucker. Shame the Intellisense seems to only half work.</li>
</ul>
<p>If you want to be able to call it with late-binding, there are <a href="http://www.codeproject.com/vb/net/MusaExposingCOM.asp">some extra hoops to jump through</a>.</p>
<h3>How to call COM/VB6 DLLs from .Net</h3>
<p>It&#8217;s really easy. Just add the reference to the COM DLL.</p>
<p>But beware: in .Net, merely setting an object to Nothing doesn&#8217;t release it immediately; it gets released at some stage later, when the .Net runtime feels like it. To force its release, use the <a href="http://getdotnetco.web101.discountasp.net/GdncStore/free/Articles/ReleasingComObjectsWithVbNet.htm">Marshal.ReleaseComObject method</a>.</p>
<p>And if you&#8217;re calling from Asp.Net, check if you need to use the ASPCompat option, or use Com Plus, which is <a href="http://support.microsoft.com/kb/303375">necessary when calling COM from a web service</a>, otherwise you&#8217;ll get weird results if you happen to get two calls happening simultaneously.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.geekrant.org/2006/07/26/calling-com-dotnet/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Fun with wildcards and DOS 8.3 filenames</title>
		<link>http://www.geekrant.org/2006/06/01/windows-8-3-wildcards/</link>
		<comments>http://www.geekrant.org/2006/06/01/windows-8-3-wildcards/#comments</comments>
		<pubDate>Thu, 01 Jun 2006 07:35:23 +0000</pubDate>
		<dc:creator>daniel</dc:creator>
				<category><![CDATA[VB]]></category>
		<category><![CDATA[Windows]]></category>

		<guid isPermaLink="false">http://www.geekrant.org/?p=713</guid>
		<description><![CDATA[I&#8217;ve found under some circumstances, new versions of Windows (XP and 2000, using NTFS) are still looking at the DOS 8.3 versions of filenames when using wildcards. Real world example: a set of files such as tpo12345.xml tpo12346.xml tpo12347.xml etc. To find these, you&#8217;d use a wildcard such as tpo?????.xml If you have a file [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve found under some circumstances, new versions of Windows (XP and 2000, using NTFS) are still looking at the DOS 8.3 versions of filenames when using wildcards.</p>
<p>Real world example: a set of files such as tpo12345.xml tpo12346.xml tpo12347.xml etc. To find these, you&#8217;d use a wildcard such as tpo?????.xml</p>
<p>If you have a file called tpo1234567890.xml, it shouldn&#8217;t match using this wildcard, but it does, because the filename&#8217;s backward-compatible short version (in DOS 8.3 format) is something like TPO123~1.XML, which matches. It appears to only happen when the first part of the wildcard (without the suffix) is 8 characters long.</p>
<p>So it may be ten years since most of us said goodbye to short filenames, but it seems they&#8217;re still with us. I wonder if Windows Vista will still use them?</p>
<ul>
<li><a href="http://cquirke.mvps.org/9x/lfns.htm">Some details on how long filenames work</a></li>
<li>The same behaviour manifests itself in VB Classic&#8217;s <a href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbenlr98/html/vafctDir.asp">dir function</a>. I haven&#8217;t checked for it in the VBScript <a href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/script56/html/88dcdb0a-db3f-4cbc-9185-ada33004b1fa.asp">File System Object</a>.</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.geekrant.org/2006/06/01/windows-8-3-wildcards/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

