-----------------------------------------------------------

New Message on BDOTNET

-----------------------------------------------------------
From: dnyanesh
Message 1 in Discussion



Pls check this code where i am wrong. 

Object reference not set to an instance of an object. 

webuserControl.ascx

Imports System

Imports System.Web.UI

Imports System.Web.UI.UserControl

Imports System.Web.UI.WebControls

Public MustInherit Class WebUserControl1

Inherits System.Web.UI.UserControl

Public WithEvents Button1 As System.Web.UI.WebControls.Button

Public WithEvents Label1 As Label

Public WithEvents TextBox1 As TextBox

#Region " Web Form Designer Generated Code "

'This call is required by the Web Form Designer.

<System.Diagnostics.DebuggerStepThrough()> Public Sub InitializeComponent()

End Sub

Public Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) 
Handles MyBase.Init

'CODEGEN: This method call is required by the Web Form Designer

'Do not modify it using the code editor.

InitializeComponent()

End Sub

#End Region

Public Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) 
Handles MyBase.Load

'Put user code to initialize the page here

Label1.Text = "UserControl"

End Sub

Public Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) 
Handles Button1.Click

Label1.Text = TextBox1.Text

End Sub

End Class

===

webform.aspx

ublic Class WebForm1

Inherits System.Web.UI.Page

Protected WithEvents Label1 As System.Web.UI.WebControls.Label

Protected WithEvents TextBox1 As System.Web.UI.WebControls.TextBox

 

#Region " Web Form Designer Generated Code "

'This call is required by the Web Form Designer.

<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()

End Sub

Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) 
Handles MyBase.Init

'CODEGEN: This method call is required by the Web Form Designer

'Do not modify it using the code editor.

InitializeComponent()

End Sub

#End Region

Protected WithEvents aa As WebUserControl1

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) 
Handles MyBase.Load

Try

If Page.IsPostBack Then

Response.Write(aa.Label1.Text)

End If

Catch ex As Exception

Response.Write(ex.Message)

End Try

End Sub

End Class
Big guns are booming! Bollywood is a war zone! Catch all the filmi action this 
December. 

-----------------------------------------------------------

To stop getting this e-mail, or change how often it arrives, go to your E-mail 
Settings.
http://groups.msn.com/bdotnet/_emailsettings.msnw

Need help? If you've forgotten your password, please go to Passport Member Services.
http://groups.msn.com/_passportredir.msnw?ppmprop=help

For other questions or feedback, go to our Contact Us page.
http://groups.msn.com/contact

If you do not want to receive future e-mail from this MSN group, or if you received 
this message by mistake, please click the "Remove" link below. On the pre-addressed 
e-mail message that opens, simply click "Send". Your e-mail address will be deleted 
from this group's mailing list.
mailto:[EMAIL PROTECTED]

Reply via email to