<?xml version="1.0" encoding="utf-8" ?>
<?xml-stylesheet type="text/xsl" href="RSS_xslt_style.asp" version="1.0" ?>
<rss version="2.0" xmlns:WebWizForums="https://syndication.webwiz.net/rss_namespace/">
 <channel>
  <title>Codejock Developer Community : SOLVED: MarkupContext.SetHandler method in VB.net</title>
  <link>http://forum.codejock.com/</link>
  <description><![CDATA[This is an XML content feed of; Codejock Developer Community : MarkupLabel Control : SOLVED: MarkupContext.SetHandler method in VB.net]]></description>
  <copyright>Copyright (c) 2006-2013 Web Wiz Forums - All Rights Reserved.</copyright>
  <pubDate>Fri, 17 Apr 2026 09:49:57 +0000</pubDate>
  <lastBuildDate>Thu, 19 Apr 2012 10:13:52 +0000</lastBuildDate>
  <docs>http://blogs.law.harvard.edu/tech/rss</docs>
  <generator>Web Wiz Forums 12.04</generator>
  <ttl>360</ttl>
  <WebWizForums:feedURL>forum.codejock.com/RSS_post_feed.asp?TID=19666</WebWizForums:feedURL>
  <image>
   <title><![CDATA[Codejock Developer Community]]></title>
   <url>http://forum.codejock.com/forum_images/codejock-logo.gif</url>
   <link>http://forum.codejock.com/</link>
  </image>
  <item>
   <title><![CDATA[SOLVED: MarkupContext.SetHandler method in VB.net : Wow!Thanks a lot! I&amp;#039;ve been...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=19666&amp;PID=68029&amp;title=solved-markupcontext-sethandler-method-in-vb-net#68029</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=5065">gibrael</a><br /><strong>Subject:</strong> 19666<br /><strong>Posted:</strong> 19 April 2012 at 10:13am<br /><br /><img src="http://forum.codejock.com/smileys/smiley32.gif" border="0" alt="Clap" title="Clap" />&nbsp;Wow!<div>Thanks a lot! I've been wracking my brains whole afternoon looking for a solution! This worked perfectly!&nbsp;</div><div><br></div><div>Thanks again!</div>]]>
   </description>
   <pubDate>Thu, 19 Apr 2012 10:13:52 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=19666&amp;PID=68029&amp;title=solved-markupcontext-sethandler-method-in-vb-net#68029</guid>
  </item> 
  <item>
   <title><![CDATA[SOLVED: MarkupContext.SetHandler method in VB.net :  I don&amp;#039;t have a VB.Net sample...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=19666&amp;PID=68025&amp;title=solved-markupcontext-sethandler-method-in-vb-net#68025</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=369">SuperMario</a><br /><strong>Subject:</strong> 19666<br /><strong>Posted:</strong> 19 April 2012 at 8:59am<br /><br /><div><div>I don't have a VB.Net sample handy, but here is some C# code. &nbsp;I assume you are wanting SetHandler to use events in Markup:</div><div><br></div><div>/*</div><div>Your class needs to implement the IDispatch interface.</div><div><br></div><div>You need to add "using System.Runtime.InteropServices;" at the top of your file and "&#091;ComVisible(true), ClassInterface(ClassInterfaceType.AutoDispatch)&#093;" above your class declaration.</div></div><div><br></div><div>Please note that you need to set the event handler in Markup, i.e. &lt;Hyperlink Click='Hyperlink_Click'&gt;</div><div>*/</div><div><br></div><div>//Need to include this</div><div>using System.Runtime.InteropServices;</div><div><br></div><div>namespace MarkupSample</div><div>{</div><div><div>&nbsp; &nbsp; &nbsp; &nbsp; public Form1()</div><div>&nbsp; &nbsp; &nbsp; &nbsp; {</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; InitializeComponent();</div><div>&nbsp; &nbsp; &nbsp; &nbsp; }</div></div><div><br></div><div>&nbsp; &nbsp; //Need this line</div><div>&nbsp; &nbsp; &#091;ComVisible(true), ClassInterface(ClassInterfaceType.AutoDispatch)&#093;</div><div>&nbsp; &nbsp; public partial class Form1 : Form</div><div>&nbsp; &nbsp; {</div><div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Label1.Caption = "&lt;TextBlock&gt;Click &lt;Hyperlink Tag='This!' Click='Hyperlink_Click'&gt;this&lt;/Hyperlink&gt; or &lt;Hyperlink Tag='That!' Click='Hyperlink_Click'&gt;that&lt;/Hyperlink&gt; link. &nbsp;(Shows how to handle Markup Events)&lt;/TextBlock&gt;";</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Label1.MarkupContext.SetHandler(this);</div></div><div>&nbsp; &nbsp; }</div><div><br></div><div>//Then need this</div><div><div>&nbsp; &nbsp; &nbsp; &nbsp; &#091;ComVisible(true)&#093;</div><div>&nbsp; &nbsp; &nbsp; &nbsp; public void Hyperlink_Click(XtremeMarkup.MarkupObject Sender, XtremeMarkup.MarkupRoutedEventArgs Args)</div><div>&nbsp; &nbsp; &nbsp; &nbsp; {</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; try</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; XtremeMarkup.MarkupHyperlink Element;</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Element = (XtremeMarkup.MarkupHyperlink)Sender;</div><div><br></div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; MessageBox.Show("Clicked: " + Element.Tag);</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; catch</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; MessageBox.Show("Clicked");</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</div><div>&nbsp; &nbsp; &nbsp; &nbsp; }</div></div><div>}</div>]]>
   </description>
   <pubDate>Thu, 19 Apr 2012 08:59:16 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=19666&amp;PID=68025&amp;title=solved-markupcontext-sethandler-method-in-vb-net#68025</guid>
  </item> 
  <item>
   <title><![CDATA[SOLVED: MarkupContext.SetHandler method in VB.net :  Hi,How would we use the Sethandler...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=19666&amp;PID=68020&amp;title=solved-markupcontext-sethandler-method-in-vb-net#68020</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=5065">gibrael</a><br /><strong>Subject:</strong> 19666<br /><strong>Posted:</strong> 19 April 2012 at 6:31am<br /><br /><span style="text-align: left; : rgb248, 248, 252; ">Hi,</span><div style="text-align: left; : rgb248, 248, 252; "><br></div><div style="text-align: left; : rgb248, 248, 252; ">How would we use the Sethandler method in VB.net?</div><div style="text-align: left; : rgb248, 248, 252; "><br></div><div style="text-align: left; : rgb248, 248, 252; ">In VB6, it's simply</div><div style="text-align: left; : rgb248, 248, 252; "><br></div><div style="text-align: left; : rgb248, 248, 252; "><span ="apple-tab-span"="" style="white-space: pre; ">	</span>Dim markup as MarkupLabel</div><div style="text-align: left; : rgb248, 248, 252; "><span ="apple-tab-span"="" style="white-space: pre; ">	</span>markup.MarkupContext.SetHandler Me</div><div style="text-align: left; : rgb248, 248, 252; "><br></div><div style="text-align: left; : rgb248, 248, 252; ">How do we do this in .NET?</div><div style="text-align: left; : rgb248, 248, 252; ">It's always throwing an InvalidCastException.</div><div style="text-align: left; : rgb248, 248, 252; "><br></div><div style="text-align: left; : rgb248, 248, 252; ">Thanks.</div>]]>
   </description>
   <pubDate>Thu, 19 Apr 2012 06:31:59 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=19666&amp;PID=68020&amp;title=solved-markupcontext-sethandler-method-in-vb-net#68020</guid>
  </item> 
 </channel>
</rss>