<?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>Peder Borg Borup &#187; Visual Basic .NET</title> <atom:link href="http://www.pederborg.dk/category/visual-basic-net/feed/" rel="self" type="application/rss+xml" /><link>http://www.pederborg.dk</link> <description>Just another WordPress weblog</description> <lastBuildDate>Sat, 04 Jun 2011 06:54:33 +0000</lastBuildDate> <language>en</language> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <generator>http://wordpress.org/?v=3.3.1</generator> <item><title>Howto: Getting specific Command Line Argument using vb.net in a console application</title><link>http://www.pederborg.dk/2007/11/19/howto-getting-specific-command-line-argument-using-vbnet-in-a-console-application/</link> <comments>http://www.pederborg.dk/2007/11/19/howto-getting-specific-command-line-argument-using-vbnet-in-a-console-application/#comments</comments> <pubDate>Mon, 19 Nov 2007 10:14:48 +0000</pubDate> <dc:creator>Peder Borg Borup</dc:creator> <category><![CDATA[Visual Basic .NET]]></category><guid
isPermaLink="false">http://www.greencows.net/2007/11/19/howto-getting-specific-command-line-argument-using-vbnet-in-a-console-application/</guid> <description><![CDATA[Lately I&#8217;ve been struggling to find a built-in function in vb.net that, in a console application, would return a specific command line argument. However &#8211; I did&#8217;nt find it. Instead, I wrote this piece of code to do the function, that can be used when calling the .exe like this: &#34;c:\programname.exe /file:c:\folder\filename.txt&#34; &#8221;&#8217; &#60;summary&#62; &#8221;&#8217; [...]]]></description> <content:encoded><![CDATA[<p>Lately I&#8217;ve been struggling to find a built-in function in vb.net that, in a console application, would return a specific command line argument. However &#8211; I did&#8217;nt find it.</p><p>Instead, I wrote this piece of code to do the function, that can be used when calling the .exe like this: &quot;c:\programname.exe /file:c:\folder\filename.txt&quot;</p><blockquote><p>&#8221;&#8217; &lt;summary&gt; <br
/>&#8221;&#8217; A function that returns a specific Command Line Argument from format c:\commandname.exe /arg:value <br
/>&#8221;&#8217; &lt;/summary&gt; <br
/>&#8221;&#8217; &lt;param name=&quot;arg&quot;&gt;The name of the argument to return&lt;/param&gt; <br
/>&#8221;&#8217; &lt;param name=&quot;oArgs&quot;&gt;An arraylist of arguments&lt;/param&gt; <br
/>&#8221;&#8217; &lt;returns&gt;String&lt;/returns&gt; <br
/>&#8221;&#8217; &lt;remarks&gt;&lt;/remarks&gt; <br
/>Private Function ReturnSpecificCommandLineArg(ByVal arg As String, ByVal oArgs As ArrayList) As String</p><p>Dim _ReturnString As String = String.Empty</p><p>Try <br
/>With oArgs</p><p>&#8216;We don&#8217;t really need to sort &#8211; but hey! <br
/>.Sort()</p><p>&#8216;Looping throug the array to find the arguments <br
/>For i As Integer = 0 To .Count &#8211; 1</p><p>If InStr(.Item(i).ToString, arg) &gt; 0 Then</p><p>&#8216;Getting the specific value <br
/>_ReturnString = .Item(i).ToString.Substring(InStr(.Item(i).ToString, &quot;:&quot;))</p><p>&#8216;We&#8217;ve found the value &#8211; so we need to exit our for-loop <br
/>Exit For</p><p>Else <br
/>&#8216;Returning an empty string if we did&#8217;nt find what we were looking for <br
/>_ReturnString = String.Empty <br
/>End If</p><p>Next <br
/>End With</p><p>Return _ReturnString</p><p>Catch ex As Exception <br
/>&#8216;Handling errors <br
/>Throw New Exception(ex.Message, ex.InnerException)</p><p>End Try <br
/>End Function</p></p></blockquote><div
class="wlWriterSmartContent" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:f5aaa2bc-e51e-4fdd-97ef-4ec0d5703fec" style="padding-right: 0px; display: inline; padding-left: 0px; padding-bottom: 0px; margin: 0px; padding-top: 0px">Technorati Tags: <a
href="http://technorati.com/tags/vb.net" rel="tag">vb.net</a>, <a
href="http://technorati.com/tags/Commandline%20argument" rel="tag">Commandline argument</a>, <a
href="http://technorati.com/tags/console%20application" rel="tag">console application</a></div> ]]></content:encoded> <wfw:commentRss>http://www.pederborg.dk/2007/11/19/howto-getting-specific-command-line-argument-using-vbnet-in-a-console-application/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Howto: Delete user from Active Directory using Visual Basic .NET (System.DirectoryServices)</title><link>http://www.pederborg.dk/2007/08/30/howto-delete-user-from-active-directory-using-visual-basic-net-systemdirectoryservices/</link> <comments>http://www.pederborg.dk/2007/08/30/howto-delete-user-from-active-directory-using-visual-basic-net-systemdirectoryservices/#comments</comments> <pubDate>Thu, 30 Aug 2007 13:19:57 +0000</pubDate> <dc:creator>Peder Borg Borup</dc:creator> <category><![CDATA[Visual Basic .NET]]></category><guid
isPermaLink="false">http://tech.pederborgpoulsen.dk/2007/08/30/howto-delete-user-from-active-directory-using-visual-basic-net-systemdirectoryservices/</guid> <description><![CDATA[Small function to delete a user from Active Directory. &#8221;&#8217; &#60;summary&#62;&#8221;&#8217; A function that deletes a user from Active Directory&#8221;&#8217; &#60;/summary&#62;&#8221;&#8217; &#60;param name=&#8221;DirEntry&#8221;&#62;The Directory Entry that specifies the OU that holds the user&#60;/param&#62;&#8221;&#8217; &#60;param name=&#8221;sCommonName&#8221;&#62;The Common Name (CN) of the user to delete&#60;/param&#62;&#8221;&#8217; &#60;returns&#62;true/false&#60;/returns&#62;&#8221;&#8217; &#60;remarks&#62;&#60;/remarks&#62;Private Function AdUserDelete(ByVal DirEntry As DirectoryEntry, ByVal sCommonName As String) As [...]]]></description> <content:encoded><![CDATA[<p>Small function to delete a user from Active Directory.</p><blockquote><p>&#8221;&#8217; &lt;summary&gt;<br
/>&#8221;&#8217; A function that deletes a user from Active Directory<br
/>&#8221;&#8217; &lt;/summary&gt;<br
/>&#8221;&#8217; &lt;param name=&#8221;DirEntry&#8221;&gt;The Directory Entry that specifies the OU that holds the user&lt;/param&gt;<br
/>&#8221;&#8217; &lt;param name=&#8221;sCommonName&#8221;&gt;The Common Name (CN) of the user to delete&lt;/param&gt;<br
/>&#8221;&#8217; &lt;returns&gt;true/false&lt;/returns&gt;<br
/>&#8221;&#8217; &lt;remarks&gt;&lt;/remarks&gt;<br
/>Private Function AdUserDelete(ByVal DirEntry As DirectoryEntry, ByVal sCommonName As String) As Boolean<p>&nbsp;&nbsp;&nbsp; &#8216;Returning false if something goes wrong<br
/>&nbsp;&nbsp;&nbsp; AdUserDelete = False<p>&nbsp;&nbsp;&nbsp; Try<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &#8216;Finding the user<br
/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Dim _User As DirectoryEntry = DirEntry.Children.Find(&#8220;CN=&#8221; &amp; sCommonName, &#8220;User&#8221;)<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &#8216;Removing the user<br
/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; DirEntry.Children.Remove(_User)<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &#8216;Committing the changes<br
/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; DirEntry.CommitChanges()<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &#8216;Closing<br
/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; DirEntry.Close()<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &#8216;Went well &#8211; returning true<br
/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; AdUserDelete = True<p>&nbsp;&nbsp;&nbsp; Catch ex As Exception<br
/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &#8216;Throwing an error<br
/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Throw New Exception(ex.Message, ex.InnerException)<br
/>&nbsp;&nbsp;&nbsp; End Try<br
/>End Function</p></blockquote><div
class="wlWriterSmartContent" id="0767317B-992E-4b12-91E0-4F059A8CECA8:138f4237-f824-4e70-a0b0-1c4e7015378c" contenteditable="false" style="padding-right: 0px; display: inline; padding-left: 0px; padding-bottom: 0px; margin: 0px; padding-top: 0px">Technorati Tags: <a
href="http://technorati.com/tags/Active%20Directory" rel="tag">Active Directory</a>, <a
href="http://technorati.com/tags/Visual%20Basic%20.NET" rel="tag">Visual Basic .NET</a></div> ]]></content:encoded> <wfw:commentRss>http://www.pederborg.dk/2007/08/30/howto-delete-user-from-active-directory-using-visual-basic-net-systemdirectoryservices/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Howto: Set password for user in Active Directory using Visual Basic .NET (System.DirectoryServices)</title><link>http://www.pederborg.dk/2007/08/30/howto-set-password-for-user-in-active-directory-using-visual-basic-net-systemdirectoryservices/</link> <comments>http://www.pederborg.dk/2007/08/30/howto-set-password-for-user-in-active-directory-using-visual-basic-net-systemdirectoryservices/#comments</comments> <pubDate>Thu, 30 Aug 2007 12:37:08 +0000</pubDate> <dc:creator>Peder Borg Borup</dc:creator> <category><![CDATA[Visual Basic .NET]]></category><guid
isPermaLink="false">http://tech.pederborgpoulsen.dk/2007/08/30/howto-set-password-for-user-in-active-directory-using-visual-basic-net-systemdirectoryservices/</guid> <description><![CDATA[This small function can be used to set the password for a specific user in the AD. &#8221;&#8217; &#60;summary&#62;&#8221;&#8217; Function that sets the password for a specific user&#8221;&#8217; &#60;/summary&#62;&#8221;&#8217; &#60;param name=&#8221;DirEntry&#8221;&#62;The DirectoryEntry to use eq the user&#60;/param&#62;&#8221;&#8217; &#60;param name=&#8221;sPassword&#8221;&#62;The password&#60;/param&#62;&#8221;&#8217; &#60;returns&#62;true/false&#60;/returns&#62;&#8221;&#8217; &#60;remarks&#62;&#60;/remarks&#62;Private Function AdUserSetPassword(ByVal DirEntry As DirectoryEntry, ByVal sPassword As String) As Boolean &#160;&#160;&#160; &#8216;Return [...]]]></description> <content:encoded><![CDATA[<p>This small function can be used to set the password for a specific user in the AD.</p><blockquote><p>&#8221;&#8217; &lt;summary&gt;<br
/>&#8221;&#8217; Function that sets the password for a specific user<br
/>&#8221;&#8217; &lt;/summary&gt;<br
/>&#8221;&#8217; &lt;param name=&#8221;DirEntry&#8221;&gt;The DirectoryEntry to use eq the user&lt;/param&gt;<br
/>&#8221;&#8217; &lt;param name=&#8221;sPassword&#8221;&gt;The password&lt;/param&gt;<br
/>&#8221;&#8217; &lt;returns&gt;true/false&lt;/returns&gt;<br
/>&#8221;&#8217; &lt;remarks&gt;&lt;/remarks&gt;<br
/>Private Function AdUserSetPassword(ByVal DirEntry As DirectoryEntry, ByVal sPassword As String) As Boolean<p>&nbsp;&nbsp;&nbsp; &#8216;Return false if something goes wrong<br
/>&nbsp;&nbsp;&nbsp; AdUserSetPassword = False<p>&nbsp;&nbsp;&nbsp; Try<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &#8216;Creating an object-&#8221;array&#8221; to store the password<br
/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Dim _Password As Object() = New Object() {sPassword}<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &#8216;Calling a method<br
/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; DirEntry.Invoke(&#8220;SetPassword&#8221;, _Password)<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &#8216;Returning true<br
/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; AdUserSetPassword = True<p>&nbsp;&nbsp;&nbsp; Catch ex As Exception<br
/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &#8216;Throwing exception<br
/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Throw New Exception(ex.Message, ex.InnerException)<br
/>&nbsp;&nbsp;&nbsp; End Try<br
/>End Function</p></blockquote><div
class="wlWriterSmartContent" id="0767317B-992E-4b12-91E0-4F059A8CECA8:48e73117-a008-457a-bcf3-81d9d624609d" contenteditable="false" style="padding-right: 0px; display: inline; padding-left: 0px; padding-bottom: 0px; margin: 0px; padding-top: 0px">Technorati Tags: <a
href="http://technorati.com/tags/Active%20Directory" rel="tag">Active Directory</a>, <a
href="http://technorati.com/tags/Visual%20Basic%20.NET" rel="tag">Visual Basic .NET</a></div> ]]></content:encoded> <wfw:commentRss>http://www.pederborg.dk/2007/08/30/howto-set-password-for-user-in-active-directory-using-visual-basic-net-systemdirectoryservices/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Howto: Update user property in Active Directory using Visual Basic .NET (System.DirectoryServices)</title><link>http://www.pederborg.dk/2007/08/30/howto-update-user-property-in-active-directory-using-visual-basic-net-systemdirectoryservices/</link> <comments>http://www.pederborg.dk/2007/08/30/howto-update-user-property-in-active-directory-using-visual-basic-net-systemdirectoryservices/#comments</comments> <pubDate>Thu, 30 Aug 2007 07:24:26 +0000</pubDate> <dc:creator>Peder Borg Borup</dc:creator> <category><![CDATA[Visual Basic .NET]]></category><guid
isPermaLink="false">http://tech.pederborgpoulsen.dk/2007/08/30/howto-update-user-property-in-active-directory-using-visual-basic-net-systemdirectoryservices/</guid> <description><![CDATA[To update a user property in your Active Directory (e.g. telephone, common name, description), you can use this function. The DirectoryEntry should point to the specific user that you wish to update. &#8221;&#8217; &#60;summary&#62;&#8221;&#8217; A function that set the property of an object in Active Directory&#8221;&#8217; &#60;/summary&#62;&#8221;&#8217; &#60;param name=&#8221;DirEntry&#8221;&#62;The DirectoryEntry to use eq the user&#60;/param&#62;&#8221;&#8217; [...]]]></description> <content:encoded><![CDATA[<p>To update a user property in your Active Directory (e.g. telephone, common name, description), you can use this function. The DirectoryEntry should point to the specific user that you wish to update.</p><blockquote><p>&#8221;&#8217; &lt;summary&gt;<br
/>&#8221;&#8217; A function that set the property of an object in Active Directory<br
/>&#8221;&#8217; &lt;/summary&gt;<br
/>&#8221;&#8217; &lt;param name=&#8221;DirEntry&#8221;&gt;The DirectoryEntry to use eq the user&lt;/param&gt;<br
/>&#8221;&#8217; &lt;param name=&#8221;PropertyName&#8221;&gt;The property to set&lt;/param&gt;<br
/>&#8221;&#8217; &lt;param name=&#8221;PropertyValue&#8221;&gt;The value to set to the property&lt;/param&gt;<br
/>&#8221;&#8217; &lt;returns&gt;true/false&lt;/returns&gt;<br
/>&#8221;&#8217; &lt;remarks&gt;&lt;/remarks&gt;<br
/>Private Function AdUserSetProperty(ByVal DirEntry As DirectoryEntry, ByVal PropertyName As String, ByVal PropertyValue As String) As Boolean<p>&nbsp;&nbsp;&nbsp; AdUserSetProperty = False<p>&nbsp;&nbsp;&nbsp; &#8216;Specifying Administrator Account<br
/>&nbsp;&nbsp;&nbsp; DirEntry.Username = My.Settings.AdAdminUserName<br
/>&nbsp;&nbsp;&nbsp; DirEntry.Password = My.Settings.AdAdminPassword<p>&nbsp;&nbsp;&nbsp; Try<br
/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &#8216;If the property has a value<br
/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; If Not PropertyValue Is Nothing Then<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &#8216;Does the property exist<br
/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; If DirEntry.Properties.Contains(PropertyName) Then<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &#8216;Setting the new value<br
/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; DirEntry.Properties(PropertyName)(0) = PropertyValue<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Else<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &#8216;Creating the property if it does not exist<br
/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; DirEntry.Properties(PropertyName).Add(PropertyValue)<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; End If<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &#8216;Applying the changes<br
/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; DirEntry.CommitChanges()<br
/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &#8216;Closing<br
/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; DirEntry.Close()<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; End If<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &#8216;Returning<br
/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; AdUserSetProperty = True<p>&nbsp;&nbsp;&nbsp; Catch ex As Exception<br
/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &#8216;Returning<br
/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; AdUserSetProperty = False<br
/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &#8216;Throwing an error<br
/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Throw New Exception(ex.Message, ex.InnerException)<br
/>&nbsp;&nbsp;&nbsp; End Try<p>End Function</p></blockquote><div
class="wlWriterSmartContent" id="0767317B-992E-4b12-91E0-4F059A8CECA8:fc176aad-f9fb-4585-abc7-2803399f60f8" contenteditable="false" style="padding-right: 0px; display: inline; padding-left: 0px; padding-bottom: 0px; margin: 0px; padding-top: 0px">Technorati Tags: <a
href="http://technorati.com/tags/Active%20Directory" rel="tag">Active Directory</a>, <a
href="http://technorati.com/tags/Visual%20Basic%20.NET" rel="tag">Visual Basic .NET</a></div> ]]></content:encoded> <wfw:commentRss>http://www.pederborg.dk/2007/08/30/howto-update-user-property-in-active-directory-using-visual-basic-net-systemdirectoryservices/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>VB.NET built-in functions</title><link>http://www.pederborg.dk/2007/07/13/vbnet-built-in-functions/</link> <comments>http://www.pederborg.dk/2007/07/13/vbnet-built-in-functions/#comments</comments> <pubDate>Fri, 13 Jul 2007 08:36:12 +0000</pubDate> <dc:creator>Peder Borg Borup</dc:creator> <category><![CDATA[Visual Basic .NET]]></category><guid
isPermaLink="false">http://tech.pederborgpoulsen.dk/2007/07/13/vbnet-built-in-functions/</guid> <description><![CDATA[I&#8217;m always struggling to finding built-in functions in vb.net, that does these small things: roudning up, subtracting dates, formatting dates, math-functions etc. But, now I&#8217;ve found this great website: http://msconline.maconstate.edu/tutorials/VBNET/ It might not have all the functions &#8211; but it has the ones I need the most. Anyone has other good links? Technorati Tags: Functions]]></description> <content:encoded><![CDATA[<p>I&#8217;m always struggling to finding built-in functions in vb.net, that does these small things: roudning up, subtracting dates, formatting dates, math-functions etc. But, now I&#8217;ve found this great website:</p><p><a
title="http://msconline.maconstate.edu/tutorials/VBNET/" href="http://msconline.maconstate.edu/tutorials/VBNET/">http://msconline.maconstate.edu/tutorials/VBNET/</a></p><p>It might not have all the functions &#8211; but it has the ones I need the most. Anyone has other good links?</p><div
class="wlWriterSmartContent" id="0767317B-992E-4b12-91E0-4F059A8CECA8:4f12c647-ce06-4d11-8cd8-0bd34dceaaab" contenteditable="false" style="padding-right: 0px; display: inline; padding-left: 0px; padding-bottom: 0px; margin: 0px; padding-top: 0px">Technorati Tags: <a
href="http://technorati.com/tags/Functions" rel="tag">Functions</a></div> ]]></content:encoded> <wfw:commentRss>http://www.pederborg.dk/2007/07/13/vbnet-built-in-functions/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Windows Service &#8211; adding timer</title><link>http://www.pederborg.dk/2007/07/03/windows-service-adding-timer/</link> <comments>http://www.pederborg.dk/2007/07/03/windows-service-adding-timer/#comments</comments> <pubDate>Tue, 03 Jul 2007 20:22:28 +0000</pubDate> <dc:creator>Peder Borg Borup</dc:creator> <category><![CDATA[Visual Basic .NET]]></category><guid
isPermaLink="false">http://tech.pederborgpoulsen.dk/2007/07/03/windows-service-adding-timer/</guid> <description><![CDATA[I have done it before &#8211; and I did again today&#8230; Used about an hour trying to figure out, why a service for Windows that I created using Visual Studio 2005 did&#8217;nt work at all. It started great, restartet &#8211; all was perfect &#8211; but it did&#8217;nt tick. Until I finally found out the hard [...]]]></description> <content:encoded><![CDATA[<p>I have done it before &#8211; and I did again today&#8230; Used about an hour trying to figure out, why a service for Windows that I created using Visual Studio 2005 did&#8217;nt work at all. It started great, restartet &#8211; all was perfect &#8211; but it did&#8217;nt tick.</p><p>Until I finally found out the hard way, that you have to add a System.Timers.Timer timer instead of the Windows.Forms.Timer. I actually followed a guide somewhere on the Internet saying that I could just drag-n-drop the Timer from Components in the Service Project. But, it did&#8217;nt really help.</p><p>But what did help was adding this as the first line in the class:</p><blockquote><p>Friend WithEvents tmrCheckShows As New System.Timers.Timer</p></blockquote><p>And now the service is ticking &#8211; or elapsing.</p><div
class="wlWriterSmartContent" id="0767317B-992E-4b12-91E0-4F059A8CECA8:adddb126-d728-4f17-ba5f-121f64ec74fa" contenteditable="false" style="padding-right: 0px; display: inline; padding-left: 0px; padding-bottom: 0px; margin: 0px; padding-top: 0px">Technorati Tags: <a
href="http://technorati.com/tags/Windows%20service" rel="tag">Windows service</a>, <a
href="http://technorati.com/tags/Visual%20Studio" rel="tag">Visual Studio</a>, <a
href="http://technorati.com/tags/Timer" rel="tag">Timer</a></div> ]]></content:encoded> <wfw:commentRss>http://www.pederborg.dk/2007/07/03/windows-service-adding-timer/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Howto: ASP.NET Membership and Roles using SQL Server</title><link>http://www.pederborg.dk/2007/06/17/howto-aspnet-membership-and-roles-using-sql-server/</link> <comments>http://www.pederborg.dk/2007/06/17/howto-aspnet-membership-and-roles-using-sql-server/#comments</comments> <pubDate>Sun, 17 Jun 2007 10:29:32 +0000</pubDate> <dc:creator>Peder Borg Borup</dc:creator> <category><![CDATA[asp.net]]></category> <category><![CDATA[Visual Basic .NET]]></category><guid
isPermaLink="false">http://tech.pederborgpoulsen.dk/2007/06/17/howto-aspnet-membership-and-roles-using-sql-server/</guid> <description><![CDATA[In this short guide, I&#8217;ll show how to use a dedicated SQL Server for the Membership and Roles part of ASP.NET. Normally the membership and roles uses the local SQL Express Server and a aspnetdb in the local app_data directory of the webserver. But for many reasons (one of them central backup) I have always [...]]]></description> <content:encoded><![CDATA[<p>In this short guide, I&#8217;ll show how to use a dedicated SQL Server for the Membership and Roles part of ASP.NET. Normally the membership and roles uses the local SQL Express Server and a aspnetdb in the local app_data directory of the webserver. But for many reasons (one of them central backup) I have always wanted to be able to use my existing SQL Server (in my case SQL Server 2005).</p><p>1) Create a new database on your SQL Server to hold the membership and roles.</p><p>2) In my case I&#8217;ll create a new ASP.NET website to use for this demo. The website will be called &quot;demo_membership&quot;.</p><p>3) Populate the database you created with the membership tables. For this, you&#8217;ll use the program aspnet_regsql located in: C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727 &#8211; doubleclick to launch.</p><p><a
href="http://pedborwordpress.s3.amazonaws.com/wp-content/uploads/2008/04/screenshot-20070617-114651-1074.jpg"><img
style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" height="190" alt="screenshot-20070617-114651-1074" src="http://pedborwordpress.s3.amazonaws.com/wp-content/uploads/2008/04/screenshot-20070617-114651-1074-thumb.jpg" width="244" border="0" /></a> <a
href="http://pedborwordpress.s3.amazonaws.com/wp-content/uploads/2008/04/screenshot-20070617-114712-1075.jpg"><img
style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" height="190" alt="screenshot-20070617-114712-1075" src="http://pedborwordpress.s3.amazonaws.com/wp-content/uploads/2008/04/screenshot-20070617-114712-1075-thumb.jpg" width="244" border="0" /></a></p><p><a
href="http://pedborwordpress.s3.amazonaws.com/wp-content/uploads/2008/04/screenshot-20070617-114744-1076.jpg"><img
style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" height="190" alt="screenshot-20070617-114744-1076" src="http://pedborwordpress.s3.amazonaws.com/wp-content/uploads/2008/04/screenshot-20070617-114744-1076-thumb.jpg" width="244" border="0" /></a>&#160; <a
href="http://pedborwordpress.s3.amazonaws.com/wp-content/uploads/2008/04/screenshot-20070617-114752-1077.jpg"><img
style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" height="190" alt="screenshot-20070617-114752-1077" src="http://pedborwordpress.s3.amazonaws.com/wp-content/uploads/2008/04/screenshot-20070617-114752-1077-thumb.jpg" width="244" border="0" /></a></p><p><a
href="http://pedborwordpress.s3.amazonaws.com/wp-content/uploads/2008/04/screenshot-20070617-114813-1078.jpg"><img
style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" height="190" alt="screenshot-20070617-114813-1078" src="http://pedborwordpress.s3.amazonaws.com/wp-content/uploads/2008/04/screenshot-20070617-114813-1078-thumb.jpg" width="244" border="0" /></a></p><p>If you expand the database &#8211; you should see the membership/roles tables:</p><p><a
href="http://pedborwordpress.s3.amazonaws.com/wp-content/uploads/2008/04/screenshot-20070617-115022-1079.jpg"><img
style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" height="244" alt="screenshot-20070617-115022-1079" src="http://pedborwordpress.s3.amazonaws.com/wp-content/uploads/2008/04/screenshot-20070617-115022-1079-thumb.jpg" width="202" border="0" /></a></p><p>The database is now reade for use.</p></p><p><span
id="more-59"></span></p><p>4) Next you&#8217;ll have to edit the web.config file of your web-project to include information to use the SQL Server instead of the local SQL Express.</p><p>5) Add a connection-string that points to your membership database:</p><blockquote><p> &lt;connectionStrings&gt; <br
/>&#160;&#160; &lt;add name=&quot;CS_DemoMembership&quot; connectionString=&quot;Data Source=10.0.0.64;Initial Catalog=DemoMembership;Persist Security Info=True;User ID=DemoMembership;Password=demo&quot; <br
/>providerName=&quot;System.Data.SqlClient&quot; /&gt; <br
/> &lt;/connectionStrings&gt;</p></blockquote><p>6) Add membership-provider (in system.web):</p><blockquote><p>&lt;membership&gt; <br
/>&#160; &lt;providers&gt; <br
/>&#160;&#160;&#160; &lt;remove name=&quot;AspNetSqlMembershipProvider&quot;/&gt; <br
/>&#160;&#160;&#160; &lt;add name=&quot;AspNetSqlMembershipProvider&quot; <br
/>&#160;&#160;&#160;&#160;&#160;&#160;&#160; type=&quot;System.Web.Security.SqlMembershipProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a&quot; <br
/>&#160;&#160;&#160;&#160;&#160;&#160;&#160; connectionStringName=&quot;CS_DemoMembership&quot; <br
/>&#160;&#160;&#160;&#160;&#160;&#160;&#160; applicationName=&quot;/&quot; /&gt; <br
/>&#160; &lt;/providers&gt; <br
/>&lt;/membership&gt;</p></blockquote><p>7) Add profile-provider (in system.web):</p><blockquote><p>&lt;profile&gt; <br
/>&#160; &lt;providers&gt; <br
/>&#160;&#160;&#160; &lt;remove name=&quot;AspNetSqlProfileProvider&quot;/&gt; <br
/>&#160;&#160;&#160; &lt;add name=&quot;AspNetSqlProfileProvider&quot; connectionStringName=&quot;CS_DemoMembership&quot; applicationName=&quot;/&quot; <br
/>&#160;&#160;&#160;&#160;&#160;&#160;&#160; type=&quot;System.Web.Profile.SqlProfileProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a&quot; /&gt; <br
/>&#160; &lt;/providers&gt; <br
/>&lt;/profile&gt;</p></blockquote><p> <img
src='http://pedborwordpress.s3.amazonaws.com/wp-includes/images/smilies/icon_cool.gif' alt='8)' class='wp-smiley' /> Add roles-provider (in system.web):</p><blockquote><p>&lt;roleManager enabled=&quot;true&quot;&gt; <br
/>&#160; &lt;providers&gt; <br
/>&#160;&#160;&#160; &lt;remove name=&quot;AspNetSqlRoleProvider&quot;/&gt; <br
/>&#160;&#160;&#160; &lt;remove name=&quot;AspNetWindowsTokenRoleProvider&quot;/&gt; <br
/>&#160;&#160;&#160; &lt;add name=&quot;AspNetSqlRoleProvider&quot; connectionStringName=&quot;CS_DemoMembership&quot; applicationName=&quot;/&quot; <br
/>&#160;&#160;&#160;&#160;&#160;&#160;&#160; type=&quot;System.Web.Security.SqlRoleProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a&quot; /&gt; <br
/>&#160;&#160;&#160; &lt;add name=&quot;AspNetWindowsTokenRoleProvider&quot; applicationName=&quot;/&quot; <br
/>&#160;&#160;&#160;&#160;&#160;&#160;&#160; type=&quot;System.Web.Security.WindowsTokenRoleProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a&quot; /&gt; <br
/>&#160; &lt;/providers&gt; <br
/>&lt;/roleManager&gt;</p></blockquote><p>9) The reasen why the &lt;remove name&gt; tags are added is, that by default, the machine.config file is read, which contains these keys. As you wish to use your own keys, you have to remove the ones read from the machine.config-file.</p><p>10) My website looks like this:</p><p><a
href="http://pedborwordpress.s3.amazonaws.com/wp-content/uploads/2008/04/screenshot-20070617-120941-1080.jpg"><img
style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" height="157" alt="screenshot-20070617-120941-1080" src="http://pedborwordpress.s3.amazonaws.com/wp-content/uploads/2008/04/screenshot-20070617-120941-1080-thumb.jpg" width="244" border="0" /></a></p><p>- and I wan&#8217;t to protect the &quot;admin&quot;-folder.</p><p>11) Fire up the ASP.NET Configuration Tool (Website -&gt; ASP.NET Configuration)</p><p>12) Select &quot;Security&quot; and make sure that &quot;From Internet&quot; is chosen.</p><p>13) Add a user.</p><p><a
href="http://pedborwordpress.s3.amazonaws.com/wp-content/uploads/2008/04/screenshot-20070617-121159-1082.jpg"><img
style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" height="145" alt="screenshot-20070617-121159-1082" src="http://pedborwordpress.s3.amazonaws.com/wp-content/uploads/2008/04/screenshot-20070617-121159-1082-thumb.jpg" width="244" border="0" /></a></p><p>14) To check that the user was created select &quot;Manage Users&quot;:</p><p><a
href="http://pedborwordpress.s3.amazonaws.com/wp-content/uploads/2008/04/screenshot-20070617-121217-1083.jpg"><img
style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" height="71" alt="screenshot-20070617-121217-1083" src="http://pedborwordpress.s3.amazonaws.com/wp-content/uploads/2008/04/screenshot-20070617-121217-1083-thumb.jpg" width="244" border="0" /></a></p><p>15) Add a role &#8211; and add the user to this role.</p><p><a
href="http://pedborwordpress.s3.amazonaws.com/wp-content/uploads/2008/04/screenshot-20070617-121554-1085.jpg"><img
style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" height="72" alt="screenshot-20070617-121554-1085" src="http://pedborwordpress.s3.amazonaws.com/wp-content/uploads/2008/04/screenshot-20070617-121554-1085-thumb.jpg" width="244" border="0" /></a></p><p>16) Secure the &quot;admin&quot;-folder:</p><p><a
href="http://pedborwordpress.s3.amazonaws.com/wp-content/uploads/2008/04/screenshot-20070617-121637-1086.jpg"><img
style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" height="102" alt="screenshot-20070617-121637-1086" src="http://pedborwordpress.s3.amazonaws.com/wp-content/uploads/2008/04/screenshot-20070617-121637-1086-thumb.jpg" width="244" border="0" /></a></p><p><a
href="http://pedborwordpress.s3.amazonaws.com/wp-content/uploads/2008/04/screenshot-20070617-121713-1087.jpg"><img
style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" height="62" alt="screenshot-20070617-121713-1087" src="http://pedborwordpress.s3.amazonaws.com/wp-content/uploads/2008/04/screenshot-20070617-121713-1087-thumb.jpg" width="244" border="0" /></a></p><p>17) Just to show you &#8211; the users and roles actually are in the database on the SQL Server:</p><p><a
href="http://pedborwordpress.s3.amazonaws.com/wp-content/uploads/2008/04/screenshot-20070617-121902-1088.jpg"><img
style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" height="41" alt="screenshot-20070617-121902-1088" src="http://pedborwordpress.s3.amazonaws.com/wp-content/uploads/2008/04/screenshot-20070617-121902-1088-thumb.jpg" width="244" border="0" /></a> <a
href="http://pedborwordpress.s3.amazonaws.com/wp-content/uploads/2008/04/screenshot-20070617-121920-1089.jpg"><img
style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" height="34" alt="screenshot-20070617-121920-1089" src="http://pedborwordpress.s3.amazonaws.com/wp-content/uploads/2008/04/screenshot-20070617-121920-1089-thumb.jpg" width="244" border="0" /></a></p><p>18) Create a login-control on a public page.</p><p>19) Open the web-page, login, and you should be redirected to the secure-page:</p><p><a
href="http://pedborwordpress.s3.amazonaws.com/wp-content/uploads/2008/04/screenshot-20070617-122113-1090.jpg"><img
style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" height="128" alt="screenshot-20070617-122113-1090" src="http://pedborwordpress.s3.amazonaws.com/wp-content/uploads/2008/04/screenshot-20070617-122113-1090-thumb.jpg" width="244" border="0" /></a></p><p><a
href="http://pedborwordpress.s3.amazonaws.com/wp-content/uploads/2008/04/screenshot-20070617-122652-1092.jpg"><img
style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" height="34" alt="screenshot-20070617-122652-1092" src="http://pedborwordpress.s3.amazonaws.com/wp-content/uploads/2008/04/screenshot-20070617-122652-1092-thumb.jpg" width="244" border="0" /></a></p><div
class="wlWriterSmartContent" id="0767317B-992E-4b12-91E0-4F059A8CECA8:a1ba2046-a1ea-4678-b697-98a7030cb490" style="padding-right: 0px; display: inline; padding-left: 0px; padding-bottom: 0px; margin: 0px; padding-top: 0px">Technorati tags: <a
href="http://technorati.com/tags/asp.net" rel="tag">asp.net</a>, <a
href="http://technorati.com/tags/membership" rel="tag">membership</a>, <a<br
/> href="http://technorati.com/tags/roles" rel="tag">roles</a>, <a
href="http://technorati.com/tags/sql%20server" rel="tag">sql server</a></div> ]]></content:encoded> <wfw:commentRss>http://www.pederborg.dk/2007/06/17/howto-aspnet-membership-and-roles-using-sql-server/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Changing Gridview Column Datarow text at runtime</title><link>http://www.pederborg.dk/2007/01/25/changing-gridview-column-datarow-text-at-runtime/</link> <comments>http://www.pederborg.dk/2007/01/25/changing-gridview-column-datarow-text-at-runtime/#comments</comments> <pubDate>Thu, 25 Jan 2007 15:01:49 +0000</pubDate> <dc:creator>Peder Borg Borup</dc:creator> <category><![CDATA[Visual Basic .NET]]></category><guid
isPermaLink="false">http://tech.pederborgpoulsen.dk/2007/01/25/changing-gridview-column-datarow-text-at-runtime/</guid> <description><![CDATA[And, if you wan&#8217;t to change the text of a cell &#8211; then you&#8217;re able to use: Protected Sub GridView1_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GridView1.RowDataBoundIf e.Row.RowType = DataControlRowType.DataRow Thene.Row.Cells(2).Text = &#8220;This is my text&#8221;End IfEnd Sub Technorati tags: gridview, column, datarow, text, runtime, visual basic .net]]></description> <content:encoded><![CDATA[<p>And, if you wan&#8217;t to change the text of a cell &#8211; then you&#8217;re able to use:</p><blockquote><p>Protected Sub GridView1_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GridView1.RowDataBound<br
/>If e.Row.RowType = DataControlRowType.DataRow Then<br
/>e.Row.Cells(2).Text = &#8220;This is my text&#8221;<br
/>End If<br
/>End Sub</p></blockquote><div
class="wlWriterSmartContent" id="0767317B-992E-4b12-91E0-4F059A8CECA8:6ebb27b3-39f3-4ab1-9a93-9c7f0b9b0944" contenteditable="false" style="padding-right: 0px; display: inline; padding-left: 0px; padding-bottom: 0px; margin: 0px; padding-top: 0px">Technorati tags: <a
href="http://technorati.com/tags/gridview" rel="tag">gridview</a>, <a
href="http://technorati.com/tags/column" rel="tag">column</a>, <a
href="http://technorati.com/tags/datarow" rel="tag">datarow</a>, <a
href="http://technorati.com/tags/text" rel="tag">text</a>, <a
href="http://technorati.com/tags/runtime" rel="tag">runtime</a>, <a
href="http://technorati.com/tags/visual%20basic%20.net" rel="tag">visual basic .net</a></div> ]]></content:encoded> <wfw:commentRss>http://www.pederborg.dk/2007/01/25/changing-gridview-column-datarow-text-at-runtime/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Changing GridView Column HeaderText at runtime</title><link>http://www.pederborg.dk/2007/01/25/changing-gridview-column-headertext-at-runtime/</link> <comments>http://www.pederborg.dk/2007/01/25/changing-gridview-column-headertext-at-runtime/#comments</comments> <pubDate>Thu, 25 Jan 2007 14:41:17 +0000</pubDate> <dc:creator>Peder Borg Borup</dc:creator> <category><![CDATA[Visual Basic .NET]]></category><guid
isPermaLink="false">http://tech.pederborgpoulsen.dk/2007/01/25/changing-gridview-column-headertext-at-runtime/</guid> <description><![CDATA[Hm&#8230; Actually took me&#160;some time&#160;to figure out how to change the headertext at runtime for a column in a gridview. But after som searching I found: Protected Sub GridView1_RowCreated(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GridView1.RowCreatedIf e.Row.RowType = DataControlRowType.Header Thene.Row.Cells(1).Text = &#8220;Show me the money&#8221;End IfEnd Sub But, why can&#8217;t I just, when [...]]]></description> <content:encoded><![CDATA[<p>Hm&#8230; Actually took me&nbsp;some time&nbsp;to figure out how to change the headertext at runtime for a column in a gridview.</p><p>But after som searching I found:</p><blockquote><p>Protected Sub GridView1_RowCreated(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GridView1.RowCreated<br
/>If e.Row.RowType = DataControlRowType.Header Then<br
/>e.Row.Cells(1).Text = &#8220;Show me the money&#8221;<br
/>End If<br
/>End Sub</p></blockquote><p>But, why can&#8217;t I just, when binding the gridview use: GridView1.Columns(1).HeaderText = &#8220;Show me the money&#8221;</p></p><div
class="wlWriterSmartContent" id="0767317B-992E-4b12-91E0-4F059A8CECA8:94cf77fd-969a-4a37-910b-277f834ced25" contenteditable="false" style="padding-right: 0px; display: inline; padding-left: 0px; padding-bottom: 0px; margin: 0px; padding-top: 0px">Technorati tags: <a
href="http://technorati.com/tags/gridview" rel="tag">gridview</a>, <a
href="http://technorati.com/tags/column" rel="tag">column</a>, <a
href="http://technorati.com/tags/headertext" rel="tag">headertext</a>, <a
href="http://technorati.com/tags/runtime" rel="tag">runtime</a>, <a
href="http://technorati.com/tags/visual%20basic%20.net" rel="tag">visual basic .net</a></div> ]]></content:encoded> <wfw:commentRss>http://www.pederborg.dk/2007/01/25/changing-gridview-column-headertext-at-runtime/feed/</wfw:commentRss> <slash:comments>20</slash:comments> </item> <item><title>Creating a plugin for Windows Live Writer using VB.NET</title><link>http://www.pederborg.dk/2006/09/05/creating-a-plugin-for-windows-live-writer-using-vbnet/</link> <comments>http://www.pederborg.dk/2006/09/05/creating-a-plugin-for-windows-live-writer-using-vbnet/#comments</comments> <pubDate>Tue, 05 Sep 2006 19:36:17 +0000</pubDate> <dc:creator>Peder Borg Borup</dc:creator> <category><![CDATA[Visual Basic .NET]]></category><guid
isPermaLink="false">http://tech.pederborgpoulsen.dk/2006/09/05/creating-a-plugin-for-windows-live-writer-using-vbnet/</guid> <description><![CDATA[Although I know, that the majority of people use C# for creating plugins to Windows Live Writer &#8211; I&#8217;d still like to make a small guide into the basic concept of creating a plugin using VB.NET. 1) Create a new project in Visual Studio .NET &#160;&#160; Select the template &#34;Class Library&#34; and type the name [...]]]></description> <content:encoded><![CDATA[<p>Although I know, that the majority of people use C# for creating plugins to Windows Live Writer &#8211; I&#8217;d still like to make a small guide into the basic concept of creating a plugin using VB.NET.</p><p>1) Create a new project in Visual Studio .NET <br
/><a
href="http://pedborwordpress.s3.amazonaws.com/wp-content/uploads/2008/04/screenhunter-27.jpg"><img
style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" height="151" alt="ScreenHunter_27" src="http://pedborwordpress.s3.amazonaws.com/wp-content/uploads/2008/04/screenhunter-27-thumb.jpg" width="244" border="0" /></a>&#160;&#160; <br
/>Select the template &quot;Class Library&quot; and type the name of your project in the Name field.</p><p>2) Delete the default class created.</p><p>3) Add a new class to your project. <br
/><a
href="http://pedborwordpress.s3.amazonaws.com/wp-content/uploads/2008/04/screenhunter-28.jpg"><img
style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" height="152" alt="ScreenHunter_28" src="http://pedborwordpress.s3.amazonaws.com/wp-content/uploads/2008/04/screenhunter-28-thumb.jpg" width="244" border="0" /></a></p><p>4) Add a reference to the Windows Live Writer API.</p><p><a
href="http://pedborwordpress.s3.amazonaws.com/wp-content/uploads/2008/04/screenhunter-29.jpg"><img
style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" height="199" alt="ScreenHunter_29" src="http://pedborwordpress.s3.amazonaws.com/wp-content/uploads/2008/04/screenhunter-29-thumb.jpg" width="244" border="0" /></a></p><p>- and a reference to System.Windows.Forms</p><p><a
href="http://pedborwordpress.s3.amazonaws.com/wp-content/uploads/2008/04/screenhunter-30.jpg"><img
style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" height="200" alt="ScreenHunter_30" src="http://pedborwordpress.s3.amazonaws.com/wp-content/uploads/2008/04/screenhunter-30-thumb.jpg" width="244" border="0" /></a></p><p>5) Import the namespaces</p><div
class="wlWriterSmartContent" id="C411E4BC-FA5A-4068-9F25-1AA2B5A98D76:c78db387-8c53-468e-8be8-dd8a63703de7" style="padding-right: 0px; display: inline; padding-left: 0px; float: none; padding-bottom: 0px; margin: 0px; padding-top: 0px"><div
style="display: block; background-color: #f7f7ff"><pre>
<table>
<tbody>
<tr>
<td><span style="color: #0000ff">Imports</span> WindowsLive.Writer.Api</td>
</tr>
<tr>
<td><span style="color: #0000ff">Imports</span> System.Windows.Forms</td>
</tr>
</tbody>
</table>
</pre></div></div><p>7) Create a Folder in your project and name it Images:</p><p><a
href="http://pedborwordpress.s3.amazonaws.com/wp-content/uploads/2008/04/screenhunter-31.jpg"><img
style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" height="71" alt="ScreenHunter_31" src="http://pedborwordpress.s3.amazonaws.com/wp-content/uploads/2008/04/screenhunter-31-thumb.jpg" width="244" border="0" /></a></p><p>Create a new PNG-image at the size of 20 by 18 pixels and save it in your &quot;Images&quot;-folder.</p><p> <img
src='http://pedborwordpress.s3.amazonaws.com/wp-includes/images/smilies/icon_cool.gif' alt='8)' class='wp-smiley' /> Add the file as a ressource</p><ol><ol><li>Double-click &quot;My Project&quot;</li><li>Click &quot;Resources&quot;</li><li>Click &quot;Add Resource&quot; &#8211; and make sure you click &quot;Add Existing File&quot;, and select the image saved in your Images-folder</li><li>If you find that type system.drawing.bitmap is not defined &#8211; try adding and removing a form.</li></ol></ol><p>10) Click your image in the Images-folder and under Build Action select &quot;Embedded Resource&quot;.</p><p>9) Add some code (Please note, that the GUID should be unique for your plugin &#8211; if you need a guid &#8211; then go to <a
href="http://www.replymedia.net/guid">http://www.replymedia.net/guid</a>):</p><div
class="wlWriterSmartContent" id="C411E4BC-FA5A-4068-9F25-1AA2B5A98D76:6c839b30-c63a-48d7-8f66-8e37ad4387fb" style="padding-right: 0px; display: inline; padding-left: 0px; float: none; padding-bottom: 0px; margin: 0px; padding-top: 0px"><div
style="display: block; background-color: #f7f7ff"><pre>
<table>
<tbody>
<tr>
<td><span style="color: #0000ff">Imports</span> WindowsLive.Writer.Api</td>
</tr>
<tr>
<td><span style="color: #0000ff">Imports</span> System.Windows.Forms</td>
</tr>
<tr>
<td></td>
</tr>
<tr>
<td>&lt;WriterPluginAttribute(&quot;<span style="color: #8b0000">05D06AD8-694D-458B-9631-F8F19F88A9BA</span>&quot;, _</td>
</tr>
<tr>
<td>&quot;<span style="color: #8b0000">Insert current date and time</span>&quot;, _</td>
</tr>
<tr>
<td>Description:=&quot;<span style="color: #8b0000">Inserts current date and time</span>&quot;, _</td>
</tr>
<tr>
<td>ImagePath:=&quot;<span style="color: #8b0000">DemoPlugin.png</span>&quot;, _</td>
</tr>
<tr>
<td>HasEditableOptions:=<span style="color: #0000ff">False</span>, _</td>
</tr>
<tr>
<td>PublisherUrl:=&quot;<span style="color: #8b0000">http://tech.pederborgpoulsen.dk</span>&quot;), _</td>
</tr>
<tr>
<td>InsertableContentSourceAttribute(&quot;<span style="color: #8b0000">Current Date and Time</span>&quot;)&gt; _</td>
</tr>
<tr>
<td><span style="color: #0000ff">Public</span> <span style="color: #0000ff">Class</span> Plugin</td>
</tr>
<tr>
<td>&#160;&#160;&#160; <span style="color: #0000ff">Inherits</span> ContentSource</td>
</tr>
<tr>
<td></td>
</tr>
<tr>
<td>&#160;&#160;&#160; '<span style="color: #0000ff">Overrides</span> the <span style="color: #0000ff">function</span> CreateContent</td>
</tr>
<tr>
<td>&#160;&#160;&#160; <span style="color: #0000ff">Public</span> <span style="color: #0000ff">Overrides</span> <span style="color: #0000ff">Function</span> CreateContent(<span style="color: #0000ff">ByVal</span> dialogOwner <span style="color: #0000ff">As</span> System.Windows.Forms.IWin32Window, <span style="color: #0000ff">ByRef</span> newContent <span style="color: #0000ff">As</span> <span style="color: #0000ff">String</span>) <span style="color: #0000ff">As</span> System.Windows.Forms.DialogResult</td>
</tr>
<tr>
<td></td>
</tr>
<tr>
<td>&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color: #0000ff">Try</span></td>
</tr>
<tr>
<td>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 'Adding content <span style="color: #0000ff">to</span> newContent - newContent <span style="color: #0000ff">is</span> returned <span style="color: #0000ff">to</span> Windows Live Writer</td>
</tr>
<tr>
<td>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; newContent = FormatDateTime(Now(), DateFormat.GeneralDate).ToString</td>
</tr>
<tr>
<td></td>
</tr>
<tr>
<td>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 'Returns <span style="color: #0000ff">to</span> caller</td>
</tr>
<tr>
<td>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color: #0000ff">Return</span> DialogResult.OK</td>
</tr>
<tr>
<td></td>
</tr>
<tr>
<td>&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color: #0000ff">Catch</span> ex <span style="color: #0000ff">As</span> Exception</td>
</tr>
<tr>
<td></td>
</tr>
<tr>
<td>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; '<span style="color: #0000ff">Do</span> some <span style="color: #0000ff">error</span>-handling</td>
</tr>
<tr>
<td></td>
</tr>
<tr>
<td>&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color: #0000ff">End</span> <span style="color: #0000ff">Try</span></td>
</tr>
<tr>
<td></td>
</tr>
<tr>
<td>&#160;&#160;&#160; <span style="color: #0000ff">End</span> <span style="color: #0000ff">Function</span></td>
</tr>
<tr>
<td></td>
</tr>
<tr>
<td><span style="color: #0000ff">End</span> <span style="color: #0000ff">Class</span></td>
</tr>
</tbody>
</table>
</pre></div></div><p>10) Build the project and copy the DLL-file to your Windows Live Write Plugin-directory.</p><p>11) Start or Restart Windows Live Writer &#8211; and notice that your plugin appears in the Insert-list:</p><p><a
href="http://pedborwordpress.s3.amazonaws.com/wp-content/uploads/2008/04/screenhunter-33.jpg"><img
style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" height="155" alt="ScreenHunter_33" src="http://pedborwordpress.s3.amazonaws.com/wp-content/uploads/2008/04/screenhunter-33-thumb.jpg" width="244" border="0" /></a></p><p>12) And that clicking on it inserts the current date and time: 05-09-2006 21:32:33</p><p>&#8230; Happy Coding &#8230;</p><div
class="wlWriterSmartContent" id="d7bf807d-7bb0-458a-811f-90c51817d5c2:5ac31543-aa7e-4a72-8d94-94f38b382383" style="padding-right: 0px; display: inline; padding-left: 0px; padding-bottom: 0px; margin: 0px; padding-top: 0px"><p><span
class="TagSite">Technorati:</span> <a
class="tag" href="http://technorati.com/tag/Windows+Live+Writer" rel="tag">Windows+Live+Writer</a>, <a
class="tag" href="http://technorati.com/tag/create+plugin" rel="tag">create+plugin</a>, <a
class="tag" href="http://technorati.com/tag/embedded+resource" rel="tag">embedded+resource</a>, <a
class="tag" href="http://technorati.com/tag/guide" rel="tag">guide</a></p><p></p></div> ]]></content:encoded> <wfw:commentRss>http://www.pederborg.dk/2006/09/05/creating-a-plugin-for-windows-live-writer-using-vbnet/feed/</wfw:commentRss> <slash:comments>4</slash:comments> </item> </channel> </rss>
<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk: basic
Page Caching using disk: basic (User agent is rejected)
Database Caching 8/18 queries in 0.035 seconds using disk: basic
Content Delivery Network via Amazon Web Services: S3: pedborwordpress.s3.amazonaws.com

Served from: www.pederborg.dk @ 2012-02-07 10:56:39 -->
