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

What's the defrrence between these(sub,procedure,function,private) !!??

P: n/a
What's the defrrence between these(sub,procedure,function,private)
and when i use them
Als
i know it can be function ,sub or procedure Public or private so what does it mean Private only such as
Private ask(
.......
statmen
........
End private
Nov 20 '05 #1
Share this Question
Share on Google+
8 Replies


P: n/a
"ifrst" <an*******@discussions.microsoft.com> schrieb
What's the defrrence between these(sub,procedure,function,private)
and when i use them
Also
i know it can be function ,sub or procedure Public or private so what
does it mean Private only such as : Private ask()
.......
statment
........
End private


What about reading the VB.NET documentation?
--
Armin

http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html

Nov 20 '05 #2

P: n/a
* "=?Utf-8?B?aWZyc3Q=?=" <an*******@discussions.microsoft.com> scripsit:
What's the defrrence between these(sub,procedure,function,private)
and when i use them
Also
i know it can be function ,sub or procedure Public or private so what does it mean Private only such as :
Private ask()
.......
statment
........
End private


Quick and dirty:

A procedure is a collection of commands which will be executed.

As sub is a procedure without return value.

A function is a procedure which returns a value.

'Private' will restrict access to the procedure within the same class
only.

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05 #3

P: n/a
i know it can be function ,sub or procedure Public or private so what does it mean Private only such as :
Private ask()
.......
statment
........
End private

That's not valid code, so it means you'll get a compile error. ;-)

Mattias

--
Mattias Sjögren [MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.
Nov 20 '05 #4

P: n/a
Major ACK - Dont you just get sick of this type of question ?, I do !

OHM

Armin Zingler wrote:
"ifrst" <an*******@discussions.microsoft.com> schrieb
What's the defrrence between these(sub,procedure,function,private)
and when i use them
Also
i know it can be function ,sub or procedure Public or private so what
does it mean Private only such as : Private ask()
.......
statment
........
End private


What about reading the VB.NET documentation?


--
Best Regards - OHM

O_H_M{at}BTInternet{dot}com
Nov 20 '05 #5

P: n/a
Addendum:
Private ask()
.......
statment
........
End private
[...] 'Private' will restrict access to the procedure within the same class
only.


BTW: Your code won't compile.

\\\
Private Sub Ask()
Nov 20 '05 #6

P: n/a
Hi, if you've looked at code, and seen Private only, then you will have seen
a module-level variable declaration, there is no block syntax for private...
Private...End Private, it doesn't exist.

Private m_Var As String

This will declare a variable at the module-level, that's available only to
the class that it is declared in:

Public Class [MyClass]
Private m_Var As String

Public Sub Foobar()
MsgBox(m_Var)
End Sub
End Class

--
HTH,
-- Tom Spink, Über Geek

Woe be the day VBC.EXE says, "OrElse what?"

Please respond to the newsgroup,
so all can benefit
"ifrst" <an*******@discussions.microsoft.com> wrote in message
news:F7**********************************@microsof t.com...
What's the defrrence between these(sub,procedure,function,private)
and when i use them
Also
i know it can be function ,sub or procedure Public or private so what does it mean Private only such as : Private ask()
.......
statment
........
End private

Nov 20 '05 #7

P: n/a
"One Handed Man [ OHM# ]" <O_H_M{at}BTInternet{dot}com> schrieb
Major ACK - Dont you just get sick of this type of question ?, I do
!


I rarely ask this question - but if, it's the simplest answer. ;-)

--
Armin

http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html

Nov 20 '05 #8

P: n/a
Cor
H Ifirst

Almost everybody regular and even more in this newsgroup have answered you

And therefore I do it also, with all your questions in a sample the
description you have from Herfried

I hope this helps?

Cor
\\\\
Public Sub ask()
messagebox.show(Answer("Ifirst"))
End sub
Private function Answer(byval question as string) as string
If question = "Ifirst" then return "It is Ifirst"
End function
////
Nov 20 '05 #9

This discussion thread is closed

Replies have been disabled for this discussion.