Hi --
There is a difference between IP2003 and 2007 object models. The example you are following is probably IP2003. You can either change your form to use the older OM, so you can follow the sample, or you can try to upgrade the sample code.
To change your form, under Tools / Form Options / Programming you can remove your existing code and change the programming language to C# (InfoPath 2003). To try to update the code, you can use this article from MSDN as a guide.
Use this to refer to the current document in C# for 2007 (Me for VB.NET).
In IP2007, to get the value of a field:
MainDataSource.CreateNavigator().SelectSingleNode("/my:myFields/my:textField", this.NamespaceManager).Value