两个VB的问题,一个题10分,先答对的先给

ffb 2003-09-12 04:55:04
如何判断一个对象是窗体还是pic还是按钮。。。?
如何创建Wscript Object对象?
...全文
31 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
ffb 2003-09-12
  • 打赏
  • 举报
回复
谢谢
道素 2003-09-12
  • 打赏
  • 举报
回复
1。用typename
2。
Private Sub bBut01_Click()
Dim UsrName, SysName, DomName As String
Dim Wnet As Object

'Set Wnet = Wscript.CreateObject("Wscript.Network") Note that
the Wscript object is omitted in the VB code.

Set Wnet = CreateObject("Wscript.Network")
UsrName = Wnet.UserName
SysName = Wnet.Computername
DomName = Wnet.UserDomain

MsgBox "User: " & UsrName & "@" & DomName & vbCrLf & "Logged on to: " & SysName

End Sub

kmzs 2003-09-12
  • 打赏
  • 举报
回复
Wscript Object?
withpointer 2003-09-12
  • 打赏
  • 举报
回复
Public Function PictureOrButton(ByRef Obj ) as Boolean
If TypeOf Obj Is PictureBox Then
MsgBox "PictureBox"
ElseIf TypeOf Obj Is CommandButton Then '这行刚才写错了
MsgBox "按扭"
End If

End Function
withpointer 2003-09-12
  • 打赏
  • 举报
回复
前一个问题

Public Function PictureOrButton(ByRef Obj ) as Boolean
If TypeOf Obj Is PictureBox Then
MsgBox "PictureBox"
ElseIf TypeOf Obj Is Command Then
MsgBox "按扭"
End If

End Function

7,763

社区成员

发帖
与我相关
我的任务
社区描述
VB 基础类
社区管理员
  • VB基础类社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧