-
writing from an object to a text file when object called
I am currently trying to get an object I'm creating to write to a text file
after it has been called by a code behind file, unfortunately it's putting
up a fight and I can't find any information on doing this. I am able to write
to the text file using the same code in a .vb code behind file but when I
create the dll file it seems to be unable to instantiate the object. I suspect
I'm missing something v.simple. Unfortunately I get the compilation error
BC30182: Type expected
This would seem to imply I am not importing a necessary library, (I have
tried importing any relevent libraries I can think of...)
code for dll object file
Imports System
Imports System.Data
Imports System.Data.SqlClient
Imports System.Diagnostics
Imports System.IO
Imports System.Collections
Imports System.Text
Imports System.Reflection
Namespace FatalErrorWrite1
Public Class fatalerrorwrite
'have tested code: code works but not in object here
Dim objStreamWriter As StreamWriter
Public Function ErrorWriting(ErrorMessage As String) As Object
objStreamWriter = New StreamWriter("C:\Test.txt")
objStreamWriter.WriteLine("From the dll object")
objStreamWriter.Close()
Dim filename As String = "C:\TEST.TXT"
End function
End Class
End Namespace
code for aspx file
<%@ Page Language="VB" %>
<%@ import Namespace="System.Data" %>
<%@ import Namespace="System.Data.SqlClient" %>
<%@ import Namespace="FatalErrorWrite1" %>
<%@ import Namespace="System.IO.FileStream " %>
<%@ import Namespace="System.IO" %>
<script runat="server">
Sub Page(sa As Object, Ex As EventArgs)
Dim FERR As New FatalErrorWrite()
FERR.ErrorWriting("AAAARRGHH!!!")
End sub
</script>
<html>
<head>
<title>mike table example</title>
</head>
<body>
<font face="verdana" size="5">
<form runat="server">
page executed
</form>
</font>
</body>
</html>
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks