如何消除 Support.GetActiveControl()编译时的警告

huaer1011 2012-07-23 11:26:58
由VB6升级至VB.NET
如何消除在.netframework4 中 编译时的警告
提示:Support.GetActiveControl()过时
...全文
106 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
conggang 2012-07-27
  • 打赏
  • 举报
回复
你说的很对,给分吧!
huaer1011 2012-07-23
  • 打赏
  • 举报
回复
附上代码


'自動タブ押しメソッド
'引数1:入力中のテキストボックス・コンボボックス(Textプロパティがあるもの)
'引数2:その項目の規定サイズ
Public Sub AutoTab(ByRef LoControl As System.Windows.Forms.Control, ByRef LiStrSize As Short, Optional ByRef LvWakId As Object = Nothing)
Static LiLastSize As Short
Static LoLastControlhWnd As Integer
Static LsLastText As String
Dim LsNowText As String
'Dim LsConvType As String 使用されないローカル変数 削除必要
Dim LbWakId As Boolean

'引数省略時は枠IDではないと判断
If VarType(LvWakId) = VariantType.Error Then
LbWakId = False
Else
LbWakId = CBool(LvWakId)
End If

LsNowText = LoControl.Text
If Not LoControl.Handle.ToInt32 = LoLastControlhWnd Then
LoLastControlhWnd = LoControl.Handle.ToInt32
LiLastSize = 0
End If
Select Case LbWakId
Case False
If Len(LsNowText) = LiStrSize Then
If Len(LsNowText) - LiLastSize = 1 Then
If Not VB6.GetActiveControl() Is Nothing Then
If VB6.GetActiveControl().Handle.ToInt32 = LoControl.Handle.ToInt32 Then
System.Windows.Forms.SendKeys.SendWait("{TAB}")
If TypeOf VB6.GetActiveControl() Is System.Windows.Forms.Button Then
If VB6.GetActiveControl().Text = "..." Then
System.Windows.Forms.SendKeys.SendWait("{TAB}")
End If
End If
End If
End If
End If
Else
LiLastSize = Len(LsNowText)
End If
Case True
Select Case Mid(LsNowText, 5, 1)
Case "T", "t", "/"
If Not VB6.GetActiveControl() Is Nothing Then
If VB6.GetActiveControl().Handle.ToInt32 = LoControl.Handle.ToInt32 Then
System.Windows.Forms.SendKeys.SendWait("{TAB}")
If TypeOf VB6.GetActiveControl() Is System.Windows.Forms.Button Then
If VB6.GetActiveControl().Text = "..." Then
System.Windows.Forms.SendKeys.SendWait("{TAB}")
End If
End If
End If
End If
Case "S", "s", "-"
If Len(LsNowText) = 6 Then
If Len(LsNowText) - LiLastSize = 1 Then
If Not VB6.GetActiveControl() Is Nothing Then

If VB6.GetActiveControl().Handle.ToInt32 = LoControl.Handle.ToInt32 Then
System.Windows.Forms.SendKeys.SendWait("{TAB}")
If TypeOf VB6.GetActiveControl() Is System.Windows.Forms.Button Then

If VB6.GetActiveControl().Text = "..." Then
System.Windows.Forms.SendKeys.SendWait("{TAB}")
End If
End If
End If
End If
End If
Else
LiLastSize = Len(LsNowText)
End If
Case Else
If Len(LsNowText) = LiStrSize Then
If Len(LsNowText) - LiLastSize = 1 Then
If Not VB6.GetActiveControl() Is Nothing Then

If VB6.GetActiveControl().Handle.ToInt32 = LoControl.Handle.ToInt32 Then
System.Windows.Forms.SendKeys.SendWait("{TAB}")
If TypeOf VB6.GetActiveControl() Is System.Windows.Forms.Button Then

If VB6.GetActiveControl().Text = "..." Then
System.Windows.Forms.SendKeys.SendWait("{TAB}")
End If
End If
End If
End If
End If
Else
LiLastSize = Len(LsNowText)
End If
End Select
End Select
LsLastText = LsNowText
End Sub


16,554

社区成员

发帖
与我相关
我的任务
社区描述
VB技术相关讨论,主要为经典vb,即VB6.0
社区管理员
  • VB.NET
  • 水哥阿乐
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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