Outline ·
[ Standard ] ·
Linear+
Getting problems with vb.net codings..help, Object reference not set to an instance
|
TSjai1210
|
Jan 18 2006, 08:25 PM
|
Getting Started

|
following is my codes ....
Public Sub InsertRecord()
Dim strFileName As String = System.IO.Path.GetFileName(File1.PostedFile.FileName) Dim strDirectoryName As String = C:\Inetpub\wwwroot\....\"
If (Not (File1.PostedFile Is Nothing)) AndAlso (File1.PostedFile.ContentLength > 0) Then Try File1.PostedFile.SaveAs(strDirectoryName + strFileName) Catch ex As Exception End Try
Else LblPopUpMsg.Text = "please select a file to upload" End If
|
|
|
|
|
|
TSjai1210
|
Jan 18 2006, 08:28 PM
|
Getting Started

|
Object reference not set to an instance of an object.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.
Source Error: Dim strFileName As String = System.IO.Path.GetFileName(File1.PostedFile.FileName) Dim strDirectoryName As String = "C:\Inetpub\...\"
Stack Trace:
[NullReferenceException: Object reference not set to an instance of an object.] BadSystem.AddDocument.InsertRecord() in C:\Inetpub\wwwroot\BadSystem\AddDocument.aspx.vb:140 BadSystem.AddDocument.btnSave_Click(Object sender, EventArgs e) in C:\Inetpub\wwwroot\BadSystem\AddDocument.aspx.vb:71 System.Web.UI.WebControls.Button.OnClick(EventArgs e) System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) System.Web.UI.Page.ProcessRequestMain()
|
|
|
|
|
|
TSjai1210
|
Jan 18 2006, 08:35 PM
|
Getting Started

|
the error is point that the the HTML control input File is not declared as new class.
so how do it to declare new class for the HTML contriol? Following is the codes...can u help me declare new class for it...i really got stucks of this..
Dim strFileName As String = System.IO.Path.GetFileName(File1.PostedFile.FileName)
|
|
|
|
|
|
TSjai1210
|
Jan 18 2006, 08:53 PM
|
Getting Started

|
Anyone know how to declare new member for
Dim strFileName As String = System.IO.Path.GetFileName(File1.PostedFile.FileName)
|
|
|
|
|
|
TSjai1210
|
Jan 18 2006, 11:47 PM
|
Getting Started

|
I use vb.net for writing my coding...so?
|
|
|
|
|