The InternalStartup is for hooking up event handlers by InfoPath. Remove your
code from the InternalStartup and try putting it in the Loading event (Tools
> Programming > Loading Event) or in the Changed event of a control.
Thanks, that got it uploaded and I could put it into a forms library.
Now I don't suppose you could help me with somethign else related to the
same issue. I am basically trying to prepopulate one of the fields with the
current users windows name when the form loads, using that line of code
below. I need to form to run as a web page (in the browser, so the clients
are not required to have infopath installed). When I go to create a new form
it tells me that an error occured loading the form. Any ideas why or what I
can do?
> The InternalStartup is for hooking up event handlers by InfoPath. Remove your
> code from the InternalStartup and try putting it in the Loading event (Tools
[quoted text clipped - 18 lines]
> >
> > Any ideas what is casuing this?
David Dean - 01 Aug 2007 01:46 GMT
Have you tried the userName() function? This function was introduced in
InfoPath 2007 and returns the user's Windows login ID. You can use this
function as the default value for a form element.
See http://blogs.msdn.com/infopath/archive/2006/05/26/608092.aspx for
additional details.

Signature
David Dean
Sr. Member Technical Staff
Insource Technology Corp.
> Thanks, that got it uploaded and I could put it into a forms library.
>
[quoted text clipped - 28 lines]
> > >
> > > Any ideas what is casuing this?
Brian Farnhill - 01 Aug 2007 02:46 GMT
Thanks David. I read that blog post and I changed to code to get the users
logon with Application.User.UserName instead of System.Environment.UserName
and it works perfectly.
The function also worked, but my end game for the forms I'm working on would
involved managed code that queires a web service to return properties on the
user from some of our line of business systems and then prepopulating the
form with that information - I dont really want to have a field with thier
username on the form at all.
Thanks again for the info, this has definately pointed me in the right
direction!
> Have you tried the userName() function? This function was introduced in
> InfoPath 2007 and returns the user's Windows login ID. You can use this
[quoted text clipped - 35 lines]
> > > >
> > > > Any ideas what is casuing this?