473,378 Members | 1,236 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

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

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
8 1463
"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
* "=?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
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
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
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
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
"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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Jonas Kölker | last post by:
Hello. I'm doing a Rubik's Cube timer, so I need a function to measure 100ths of a second. I've browsed through the library reference of python.org, but I didn't find anything that struck me as...
4
by: Jack | last post by:
Hello, What function can get a string's long by JavaScript? Thank you
5
by: W. Jack | last post by:
Hello, in VBScript: Int(11.4)=11 What function in JScript like this function? Thank you
1
by: Matt | last post by:
Hello I need to find out what stored procedure was executed when I click on a button in a third party application, is there a way to find this information out in some sort of log? Some kind...
8
by: Bruce | last post by:
OK, this won't compile saying it can't access private members declared in class F. I don't get it and even if I make the entire class public, it still says that. I realize it has something to do...
2
by: Fred Bassett | last post by:
For example, a database with three tables: EMPLOYEE(employee#, empName, empAddress, empTel) EMPLOYEE_ON_PROJECT(employee#, project#) PROJECT(project#, projectStartDate, projectEndDate) What...
3
by: ashok | last post by:
Hi, I need a function that will divide text from mysql in 2 parts, so that I can display first half in one column and second half in second column. I can't find what function will do this job....
12
by: salonowiec | last post by:
My very basic code is: <?php $fname='alpha.ext'; readfile($fname); ?> Only when ext is txt I'm getting a reasonable content, otherwise there's a lot of bush. What function should I use to open...
12
by: Ziggy | last post by:
Hello, What function allows conversion md5 in text? Thanks in advance Thierry
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.