I am trying to assign a value to a textbox control on a form and use the following code.
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim txtusername As TextBox
txtusername = FormView1.FindControl("username")
txtusername.Text = getIdentity()
Public Function getIdentity() As String
getIdentity = (User.Identity.Name)
The function works fine but I get the error - Object reference not set to an instance of an object
when I try to run it.
This will work fine if I drag a textbox onto the page but just not when it is in a form template.
I am extremely new to vb.net and am using vwd 2005.
Any help would be greatly appreciated.