
13/02/2007, 15:40
|
| | Fecha de Ingreso: enero-2007
Mensajes: 80
Antigüedad: 18 años, 2 meses Puntos: 0 | |
Object reference not set to an instance of an object. Saludos, tengo otro problema estoy generando un archivo txt de la siguente forma:
Dim strStreamW As Stream
Dim strStreamWriter As StreamWriter
Dim FilePath As String
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim filename As String = Server.MapPath("~/_administracion/deudas/errores/" + FilePath)
Dim FilePath As String = Server.MapPath("~/_administracion/deudas/errores/nombreArchivo.txt")
Try
'Se abre el archivo y si no existe se crea
strStreamW = File.OpenWrite(FilePath)
strStreamWriter = New StreamWriter(strStreamW, System.Text.Encoding.UTF8)
If verifica_usuario_existe(codigo) = True Then
insertar_datos(codigo, valor1, valor2)
Else
Genera_Archivo(fecha, codigo, valor1, valor2)
Me.HyperLink1.Visible = True
End If
Catch ex As Exception
Me.Label1.Text = "Error" + ex.Message
Finally
strStreamWriter.Close()
strStreamW.Close()
cn.Close()
End Try
End sub
al correr la aplicacion me sale el siguiente error:
Server Error in '/' Application.
--------------------------------------------------------------------------------
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:
Line 91: Me.Label1Text = "Error" + ex.Message
Line 92: Finally
Line 93: strStreamWriter.Close()
Line 94: strStreamW.Close()
Line 95: cn.Close()
En la linea 93; no se porque y que estoy haciendo mal si antes si me generaba el archivo sin problemas.
Ayuda please! |