p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   General .NET (http://p2p.wrox.com/forumdisplay.php?f=122)
-   -   scope of variables in VB.NET (http://p2p.wrox.com/showthread.php?t=53085)

bhavna January 23rd, 2007 04:17 AM

scope of variables in VB.NET
 
There is a filestream and a streamwriter in Sub Main()
Dim fs As New FileStream("c:\OL_Table.htm", FileMode.Create, FileAccess.Write)
 Dim s As New StreamWriter(fs)

//code goes here

s.Close()
        fs = New FileStream("c:\OL_Table.htm", FileMode.Open, FileAccess.Read)
        Dim d As New StreamReader(fs)
        d.BaseStream.Seek(0, SeekOrigin.Begin)

and there is a class having functions

Public Class MailItemClass
    Function1: Public Function DisplayMails(ByVal PFolder As Object, ByVal SFolder As Object) As String
    Function2: Public Function DisplayBody(ByVal PFolder As Object, ByVal SFolder As Object, ByVal Msg As Object) As String

which display mailitems and the message body respectively.
I want to display these mailitems and the message body in the HTML page having filestream and streamwriter i.e. "s"
but the filestream and a streamwriter are not accessible in the class functions.
how can i display the mailitems and the message body in the same HTML page in the Sub Main()





planoie January 26th, 2007 06:00 PM

Why not just pass the stream(s) into the methods that will use them?

-Peter


All times are GMT -4. The time now is 01:19 PM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.