<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://www.infopathdev.com:443/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Code</title><link>https://www.infopathdev.com:443/forums/45.aspx</link><description /><dc:language>en</dc:language><generator>CommunityServer 2007 SP3 (Build: 31118.962)</generator><item><title>return value from ShowModalDialog in C#</title><link>https://www.infopathdev.com:443/forums/thread/12646.aspx</link><pubDate>Mon, 31 Oct 2005 07:05:01 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:12646</guid><dc:creator>AndersR</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/12646.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=12646</wfw:commentRss><description>Hi&lt;br /&gt;&lt;br /&gt;i'm opening a modal dialog box prompting user for a custom login for access to a web service.&lt;br /&gt;&lt;br /&gt;this works fine, but the code itself is pretty ugly, so i wondered if anyone could tell me the right way to handle return values from modal dialogs in managed code?&lt;br /&gt;&lt;br /&gt;thanx&lt;br /&gt;//AndersR&lt;br /&gt;&lt;br /&gt;Object login = e.XDocument.UI.ShowModalDialog("loginModal.htm", e.XDocument, 305, 328, null, null);&lt;br /&gt;if ( login == null || login.ToString() == "" || login.ToString().Split('¤').Length &amp;lt; 3 )&lt;br /&gt;{&lt;br /&gt;	e.XDocument.UI.Alert("Missing credentials in login");&lt;br /&gt;	e.ReturnStatus = false;&lt;br /&gt;	return;&lt;br /&gt;}&lt;br /&gt;else&lt;br /&gt;{&lt;br /&gt;	String[] loginArray = login.ToString().Split('¤');&lt;br /&gt;	SetLoginCredentials(loginArray[0],loginArray[1],loginArray[2]);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;</description></item></channel></rss>