在vb.net xaml中声明的含义 [英] The meaning of declaring in vb.net xaml

查看:77
本文介绍了在vb.net xaml中声明的含义的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

有人可以告诉我这是什么意思:-

-公开共享的WithEvents
-公共职能
-公共结构
-私人WithEvents
-公共活动
-公共建筑

我需要了解这是怎么回事.或者,如果有人知道链接,请帮助我. Tq..I''正在vb.net 2010中用于xaml(WPF应用程序)中使用它.

解决方案

这些都与XAML无关,它们都是直截了当的与VB相关并控制如何使用功能等.

Public和Private是互斥的:如果某个项目为Public,则在该类之内和之外对所有人都是可见的.私有意味着该项目仅在班级中可见.不同类中的函数根本无法访问它.
还有朋友"和受保护的",它们也控制访问级别:是时候阅读一些内容了! MSDN [ MSDN [ ^ ]可以提供帮助.

WithEvents允许通过变量引发方法事件的方法.鉴于您还不了解公共"和私人"之间的区别,因此,我不想让您感到困惑,所以我不会详细介绍,但是当您准备就绪时,请查看MSDN [ PboxClick()句柄 pbox.Click() .... .... 结束 sub


公共,私有,常量,结构:让我们看一下
链接


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 vb.net 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.


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


这篇关于在vb.net xaml中声明的含义的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆