By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,497 Members | 1,258 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,497 IT Pros & Developers. It's quick & easy.

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

P: n/a
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
Nov 21 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
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" <ma***********@yahoo.com> wrote in message
news:76****************************@phx.gbl...
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

Nov 21 '05 #2

P: n/a
"Robby" <ed****@not.my.email.com> 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/>

Nov 21 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.