Wrox Programmer Forums
Go Back   Wrox Programmer Forums > .NET > Other .NET > General .NET
| Search | Today's Posts | Mark Forums Read
General .NET For general discussion of MICROSOFT .NET topics that don't fall within any of the other .NET forum subcategories or .NET language forums.  If your question is specific to a language (C# or Visual Basic) or type of application (Windows Forms or ASP.Net) try an applicable forum category. ** PLEASE BE SPECIFIC WITH YOUR QUESTION ** When posting here, provide details regarding the Microsoft .NET language you are using and/or what type of application (Windows/Web Forms, etc) you are working in, if applicable to the question. This will help others answer the question without having to ask.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the General .NET section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old January 23rd, 2007, 04:17 AM
Authorized User
 
Join Date: Jan 2007
Location: , , .
Posts: 31
Thanks: 0
Thanked 0 Times in 0 Posts
Default 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()




  #2 (permalink)  
Old January 26th, 2007, 06:00 PM
planoie's Avatar
Friend of Wrox
Points: 16,481, Level: 55
Points: 16,481, Level: 55 Points: 16,481, Level: 55 Points: 16,481, Level: 55
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2003
Location: Clifton Park, New York, USA.
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

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

-Peter


Similar Threads
Thread Thread Starter Forum Replies Last Post
how can I pass variables to vb? astarti Beginning VB 6 4 September 5th, 2007 08:43 AM
variables in vb.net ravibodani General .NET 2 April 4th, 2006 06:06 AM
Javascript Scope of Variables. minhtam Javascript 2 January 7th, 2006 10:27 PM
Scope of recordset variables James Diamond Classic ASP Databases 2 January 28th, 2004 09:37 AM
vb.net 2002 - vb.net 2003 book metalaaron Wrox Book Feedback 0 August 2nd, 2003 10:46 PM





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