学习vb.net
来源:互联网 发布:广告牌设计软件下载 编辑:程序博客网 时间:2024/05/01 10:24
1.with...end with
With Button1 .Text = "ok" .Visible = True .Top = 200End With2.获得对象类型(或者说属于哪个类)
If Typeof(myForm) Is Form Then 'Typeof 后面只能接is,看来只能用在if语句中End IfTypeName(myForm) As String '可以用在任何位置3.CallByName 函数执行对象的方法,或者设置或返回对象的属性。智能设备不支持此函数.
Public Function CallByName( _ ByVal ObjectRef As System.Object, _ ByVal ProcName As String, _ ByVal UseCallType As CallType, _ ByVal Args() As Object _) As Object第一个参数ObjectRef表示要操作的对象.第二个参数ProcName表示要操作的方法、属性或者过程名称的字符表示.第三个参数UseCallType是一个常数选项,CallType枚举 类型的枚举成员,当操作是一个方法时,值是vbMethod;当被操作的是设置属性时,值是vbLet;得到属性时,值是vbGet;设置对象属性的值时,值是vbSet.第四个参数Args是可选的ParamArray,参数数组,包含要传递给所调用的属性和方法的参数。
Imports Microsoft.VisualBasic.CallType'在下面的示例中,第一行使用 CallByName 设置文本框的 Text 属性,第二行检索 Text 属性的值,第三行调用 Move 方法以移动文本框。Sub TestCallByName1() 'Set a property. CallByName(TextBox1, "Text", CallType.Set, "New Text") 'Retrieve the value of a property. MsgBox(CallByName(TextBox1, "Text", CallType.Get)) 'Call a method. CallByName(TextBox1, "Hide", CallType.Method)'下一个示例使用 CallByName 函数调用集合对象的 Add 和 Item 方法。Public Sub TestCallByName2() Dim col As New Collection() 'Store the string "Item One" in a collection by 'calling the Add method. CallByName(col, "Add", CallType.Method, "Item One") 'Retrieve the first entry from the collection using the 'Item property and display it using MsgBox(). MsgBox(CallByName(col, "Item", CallType.Get, 1))End SubEnd Sub
- VB.NET学习资料:
- vb.net 学习中..
- VB.NET 学习经验
- vb.net学习日记
- vb.net学习笔记
- 最近学习VB.NET
- VB.NET学习petshop
- VB.NET学习之一
- vb.net学习总结
- 学习vb.net
- VB.NET学习基础
- VB.NET线程学习
- VB.net学习笔记
- VB.NET学习日记
- VB.net 学习资源
- VB.net 学习总结
- VB.net学习
- VB.net学习
- android之json浅谈
- Quartz 2D编程指南(7)
- EIL MU Analysis Report (ZRPP143)
- SQL多表联合查询高效率
- AT9G45的pwm驱动有问题,快来解救小弟.
- 学习vb.net
- ViewController的生命周期
- UBUNTU Apache2的配置文件httpd.conf问题
- Android 4.0 多平台界面支持原理分析
- 基于PhoneGap+JQuery Mobile+ArcGISJavascript API实现
- Auto create and/or approve PN based on new SO line item (ZRPP144)
- Linux下Bluez编程实现
- Oracle 控制文件
- STM32学习笔记 — 之GPIO端口篇