Click here to Skip to main content
15,879,844 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi all,

Could someone tell me what is the meaning of this:-

- Public Shared WithEvents
- Public Function
- Public Structure
- Private WithEvents
- Public Events
- Public Const

I need to understand what is this about. Or if anyone have the link, please help me. Tq..I'm using it for xaml (WPF Application) in 2010

None of these have any bearing on XAML, they are all straight VB related and control how functions and so forth are going to be available.

Public and Private are mutually exclusive: If an item is Public then it is visible to all, both within this class and outside it. Private means that the item is only visible within the class. Functions in different classes cannot access it at all.
There are also Friend and Protected which control the access level as well: Time to do some reading! MSDN[^]

Shared is a modifier which means that the itme is common to all instances of the class - no matter if there is zero or seven instances of a class, they all refer to the same item. If you created a Shared variable, then the value is the same regardless of which instance you are in. Again, MSDN[^] can help.

WithEvents allows methods hanlde events raised via the variable. Given that you do not understand the difference between Public and Private yet, I won't go into details as I don't want to confuse you, but when you are ready, look at MSDN[^] again.
Share this answer
Luiey Ichigo 6-Oct-11 4:12am    
TQ Griff
WithEvents: means you declare a variable in your code include event handler. For example, you write code to add a PictureBox into a Panel. if you do not use WithEvents (Dim pbox as new PictureBox), you could not control for any events on that one (Click, ...). But if you use WithEvents (Dim WithEvents pbox as new PictureBox), you could handle any events on that by:
Sub PboxClick() handles pbox.Click()
End sub

Public, Private, const, Structure: let see this Link
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900