<?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>Re: Username from registry into Textfield</title><link>https://www.infopathdev.com:443/forums/thread/40651.aspx</link><pubDate>Thu, 16 Apr 2009 12:52:17 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:40651</guid><dc:creator>partysan</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/40651.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=40651</wfw:commentRss><description>&lt;p&gt;&amp;nbsp;Hello!&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;I found the correct code:&lt;/p&gt;&lt;p&gt;I think it is a easy way to get the Username into a Textfield:&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;Dim Username
set wshshell = createobject(&amp;quot;Wscript.shell&amp;quot;) 
&lt;/p&gt;&lt;p&gt;Const strBaseKey = &amp;quot;HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Logon User Name&amp;quot; &lt;/p&gt;&lt;p&gt;
Username = wshshell.regread(strbasekey)
&lt;/p&gt;&lt;p&gt;XDocument.Dom.SelectSingleNode(&amp;quot;my:meineFelder/my:Feld1&amp;quot;).text = Username&amp;nbsp;
&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;Regards&lt;/p&gt;&lt;p&gt;Philipp &lt;br /&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description></item><item><title>Re: Username from registry into Textfield</title><link>https://www.infopathdev.com:443/forums/thread/40648.aspx</link><pubDate>Thu, 16 Apr 2009 08:07:15 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:40648</guid><dc:creator>partysan</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/40648.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=40648</wfw:commentRss><description>&lt;p&gt;&amp;nbsp;Hello!&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;Im not sure but the Code that you&amp;#39; ve been send me is written in c#, i need vbs (see above) ?&lt;span style="font-size:10pt;"&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;The second solution is not possible for me. &lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;Best Regards&lt;/p&gt;&lt;p&gt;Philipp &lt;br /&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp; &lt;br /&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description></item><item><title>Re: Username from registry into Textfield</title><link>https://www.infopathdev.com:443/forums/thread/40645.aspx</link><pubDate>Thu, 16 Apr 2009 05:49:24 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:40645</guid><dc:creator>Anuma</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/40645.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=40645</wfw:commentRss><description>&lt;p class="MsoNormal" style="MARGIN:0in 0in 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;Hi,&lt;/font&gt;&lt;/p&gt;&lt;font face="Times New Roman" size="3"&gt;&amp;nbsp;&lt;/font&gt; 
&lt;p class="MsoNormal" style="MARGIN:0in 0in 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;You can use below code to get the username.&lt;/font&gt;&lt;/p&gt;&lt;span style="FONT-SIZE:10pt;"&gt;&lt;font face="Times New Roman"&gt;thisXDocument.DOM.selectSingleNode(&lt;span style="COLOR:maroon;"&gt;&amp;quot;/dfs:myFields/dfs:dataFields/d:Buyers/d:WorkOrders/@ALCOUN&amp;quot;&lt;/span&gt;).text = System.&lt;span style="COLOR:teal;"&gt;Environment&lt;/span&gt;.UserName;&lt;/font&gt;&lt;/span&gt; 
&lt;p class="MsoNormal" style="MARGIN:0in 0in 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;And also verify below code to get user name without writing code.&lt;/font&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="MARGIN:0in 0in 0pt;"&gt;&lt;a href="http://blogs.microsoft.co.il/blogs/itaysk/archive/2007/04/05/InfoPath-_2D00_-Get-the-current-user-without-writing-code.aspx"&gt;&lt;font face="Times New Roman" color="#800080" size="3"&gt;http://blogs.microsoft.co.il/blogs/itaysk/archive/2007/04/05/InfoPath-_2D00_-Get-the-current-user-without-writing-code.aspx&lt;/font&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description></item><item><title>Username from registry into Textfield</title><link>https://www.infopathdev.com:443/forums/thread/40635.aspx</link><pubDate>Wed, 15 Apr 2009 14:28:23 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:40635</guid><dc:creator>partysan</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/40635.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=40635</wfw:commentRss><description>&lt;p&gt;&amp;nbsp;Hello!&lt;/p&gt;&lt;p&gt;I need&amp;nbsp; a solution to get the username value from the registry into a infopath textfield.(name of the textfield &amp;quot;field1&amp;quot;).&lt;/p&gt;&lt;p&gt;I work with Infopath 2003, thereforce i cannot use the &amp;quot;username&amp;quot; function. &lt;br /&gt;&lt;/p&gt;&lt;p&gt;How I modify the following code.&lt;/p&gt;&lt;p&gt;&lt;i&gt;&lt;br /&gt;&lt;/i&gt;&lt;/p&gt;&lt;p&gt;&lt;b&gt;Sub CTRL3_5_OnClick(eventObj)&lt;/b&gt;&lt;/p&gt;&lt;p&gt;&lt;b&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim Username



&lt;/b&gt;&lt;/p&gt;&lt;p&gt;&lt;b&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; set wshshell = createobject(&amp;quot;Wscript.shell&amp;quot;) 


&lt;/b&gt;&lt;/p&gt;&lt;p&gt;&lt;b&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Const strBaseKey = &amp;quot;HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Logon User Name&amp;quot; 

&lt;/b&gt;&lt;/p&gt;&lt;p&gt;&lt;b&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Username = wshshell.regread(strbasekey)



&lt;/b&gt;&lt;/p&gt;&lt;p&gt;&lt;b&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; msgbox (Username)


&lt;/b&gt;&lt;/p&gt;&lt;p&gt;Approximately (but i dont know the correct syntax) : &lt;i&gt;&lt;i&gt;myFields&lt;/i&gt;/my:field1&amp;quot;).text = Username&amp;nbsp; &lt;/i&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;b&gt;End Sub&lt;/b&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;Best regards&lt;/p&gt;&lt;p&gt;Philipp &lt;br /&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description></item></channel></rss>