PC Review


Reply
Thread Tools Rate Thread

How to declare a public variable in methods in VB.NET

 
 
Mamatha
Guest
Posts: n/a
 
      19th Nov 2004
Hi

If any one knows,please tell me how can we declare a
public variable in methods of VB.NET like

public indx as integer.

How can i use that variable in another methods like global
variable.

Mamatha
 
Reply With Quote
 
 
 
 
Robby
Guest
Posts: n/a
 
      19th Nov 2004
Procedures can not define Public variables only Private (aka Dim) and Shared
variables. If you want all procedures in your Module or Class to have
access to a variable then delare it at the Module or Class level
respectively. If delcared Private all your procedures will be able to
access the variable but prodecures outside the Module or Class will not be
able to access it directly.

--Ride

"Mamatha" <(E-Mail Removed)> wrote in message
news:763a01c4ce1b$e497a9c0$(E-Mail Removed)...
> Hi
>
> If any one knows,please tell me how can we declare a
> public variable in methods of VB.NET like
>
> public indx as integer.
>
> How can i use that variable in another methods like global
> variable.
>
> Mamatha



 
Reply With Quote
 
Herfried K. Wagner [MVP]
Guest
Posts: n/a
 
      19th Nov 2004
"Robby" <(E-Mail Removed)> schrieb:
> Procedures can not define Public variables only Private
> (aka Dim) and Shared variables.


Procedures cannot define 'Privazte' or 'Shared' variables. They can define
local or local static variables.

What you can do inside a procedure is redimensioning a private/public array
variable declared in the class using 'ReDim'.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Where to declare Public variable esha Microsoft C# .NET 15 14th Sep 2006 05:49 PM
Declare public variable in C# =?Utf-8?B?TU1TSkVE?= Microsoft C# .NET 5 1st Aug 2005 02:50 PM
Declare public variable in C#1 =?Utf-8?B?TU1TSkVE?= Microsoft C# .NET 1 1st Aug 2005 12:05 PM
How to declare variable as public. =?Utf-8?B?TWFyaw==?= Microsoft Excel Programming 3 7th Apr 2005 06:27 PM
I would like to declare a Public Function or Public Variable Henro Microsoft Access Getting Started 2 1st Dec 2003 04:27 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:33 PM.