Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > .NET > .NET 1.0 and Visual Studio.NET > VS.NET 2002/2003
Password Reminder
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
VS.NET 2002/2003 Discussions about the Visual Studio.NET programming environment, the 2002 (1.0) and 2003 (1.1). ** Please don't post code questions here ** For issues specific to a particular language in .NET, please see the other forum categories.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VS.NET 2002/2003 section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old March 3rd, 2005, 02:35 AM
Registered User
Join Date: Feb 2005
Location: kanchi, tamilnadu, India.
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default difference b/w shared and public variable


1 -> in vb.net we are using shared variable and public variable.
what is between shared variable and public variable.In which
situation we use shared and public variable.
if shared is alo act like a public variable.Are u able to give a small example coding for that

2-> in which situation we are using shared constructor(shared constructor is used to intialise the shared variables other than any thing is there)and instance constructor.Are u able to give a small example coding for that

3->i have another doubt in vb.net ,we are using commondialog,in this openfiledialog class is there,u select a particular filename and how to display the file in a particular control which is in form,i need sample coding for that.

4-> in savefiledialog how to save the file which content is in particuar textbox.i need sample coding for that.

Reply With Quote
  #2 (permalink)  
Old March 4th, 2005, 08:24 AM
Authorized User
Join Date: Mar 2005
Location: , , .
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts

1 -> a public variable can be access from outside the class but it is but it is necessary to create an object of that class but in case of shared variable you can access the variable without creating any object of that class and if the shared variable is public also it can be used outside the class.

3 -> you can try this code

        filename = myOpenFileDialog.FileName
        'showing content in the Edit Mode
        ' Declare an object for the StreamReader class...
        Dim myReader As StreamReader

        ' Open the file...
        myReader = File.OpenText(filename)

        ' Declare variables...
        Dim lineCounter As Integer = 0
        Dim currentLine As String, currentData As String

        ' Loop through the file counting the lines and loading the
        ' text box...
            currentLine = myReader.ReadLine
            lineCounter = lineCounter + 1
            currentData = currentData & currentLine & vbCrLf

        Loop While currentLine <> Nothing

        ' Load the text box...
        tbxEdit.Text = currentData

        ' Clean up...
        myReader = Nothing

Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
how to use a run time variable as public Subuana Beginning VB 6 2 May 1st, 2006 03:27 PM
Public Shared Functions? francislang General .NET 1 July 15th, 2005 02:26 PM
Shared / Public Assembly ashu_from_india General .NET 1 March 20th, 2005 07:22 AM
Passing variable to a public variable Hudson40 Access VBA 2 February 25th, 2005 06:23 AM
How to reference Public Variable in Code Gino Liu Access VBA 2 June 18th, 2003 01:42 PM

All times are GMT -4. The time now is 05:32 AM.

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