vb控件问题
Public Sub RemoveTab(ByVal lIndex As Long)' Handle Any Errors
On Error GoTo Sub_ErrHandler
Dim Ctl As Control 'Control Default Type
Dim i As Long 'Loop Counter
Dim lTab As Long 'The Computed Tab Number for Each Control
Dim MoveVal As Long 'Computed value to move the controls
Dim lActiveTab 'ActiveTab
' Must have at least one tab ;-)
If m_lTabCount = 1 Then Exit Sub
' Lock the window to improve speed and reduce flicker
LockWindowUpdate UserControl.hwnd
' Save the current tab
lActiveTab = m_lActiveTab
' Set the inital tab to be "0" so that the
' Left values are ordinal to the tab position
ActiveTab = 0
' Loop over all controls
For Each Ctl In UserControl.ContainedControls
' Now find out which Tab they are on...
If (Ctl.Left > 0) Then
' Tab(0), since the Left values are all positive
lTab = (Abs(Ctl.Left) \ m_lMoveOffset)
Else
' Must be Tab(1)....Tab(n)
lTab = (Abs(Ctl.Left) \ m_lMoveOffset) + 1
End If
' Check ths index against the lTab value
If lTab = lIndex Then
' This is the tab we are removing, so we need to set
' these to an offset which will never be seen
MoveVal = m_lMoveOffset * m_lTabCount
Ctl.Left = (Ctl.Left + MoveVal)
ElseIf lTab > lIndex Then
' These are the target....we need to move
' these down by one increment of the MoveOffset
MoveVal = m_lMoveOffset
Ctl.Left = (Ctl.Left + MoveVal)
Else
' Do nothing, these are below the tab we want to
' remove so leave them as they are...
End If
Next Ctl
' Now loop over the tabs and add the captions back
For i = 0 To m_lTabCount - 1
If i > lIndex Then
TabCaption(i - 1) = m_aryTabs(i).Caption
End If
Next i
' Change the Tab Count
TabCount = m_lTabCount - 1
' Now set the tab
If lActiveTab = lIndex Then
If lIndex = m_lTabCount - 1 Then
ActiveTab = lActiveTab - 1
Else
ActiveTab = lActiveTab + 1
End If
Else
ActiveTab = lActiveTab - 1
End If
' Unlock the window
LockWindowUpdate 0&
RaiseEvent TabRemove(lIndex)
Sub_ErrHandlerExit:
Exit Sub
Sub_ErrHandler:
Err.Raise Err.Number, "ucXTab.RemoveTab", Err.Description, Err.HelpFile, Err.HelpContext
Resume Sub_ErrHandlerExit:
End Sub
以上是用户控件里的代码,为什么我往里面加入Unload WebBrowser1(ucXTab1.ActiveTab)这代码后,运行提示变量未定义
我的目的是在RemoveTab执行前先在form里执行Unload WebBrowser1(ucXTab1.ActiveTab)
请问该怎么改? --------------------编程问答-------------------- if(ucXTab1.ActiveTab>=ubound(WebBrowser1)) Unload WebBrowser1(ucXTab1.ActiveTab)
*****************************************************************************
欢迎使用CSDN论坛专用阅读器 : CSDN Reader(附全部源代码)
http://feiyun0112.cnblogs.com/ --------------------编程问答-------------------- 我好丢脸……555,根本看不懂
补充:VB , 基础类