掲示板システム
ホーム
アクセス解析
カテゴリ
ログアウト
アクティブコントロール名を取得するには? (ID:140046)
名前
ホームページ(ブログ、Twitterなど)のURL (省略可)
本文
魔界の仮面弁士さん ご指摘のとおり確かにマズイ、SplitContainerに何が乗ってるかわかりませんからね。 If SplitContainer1.ActiveControl IsNot Nothing AndAlso _ TypeOf SplitContainer1.ActiveControl Is TextBox AndAlso _ DirectCast(SplitContainer1.ActiveControl, TextBox) Is txtCD Then 'Do Something End If かな。 読みやすくするんだったら Dim obj As Object = SplitContainer1.ActiveControl If obj IsNot Nothing AndAlso _ TypeOf obj Is TextBox AndAlso _ DirectCast(obj, TextBox) Is txtCD Then 'Do Something End If 最初に書いたように名前でやるとキャストはいらないが,いまいち..... If SplitContainer1.ActiveControl IsNot Nothing AndAlso _ SplitContainer1.ActiveControl.Name = txtCD.Name Then 'Do Something End If 面倒なので邪道だけど Try If SplitContainer1.ActiveControl Is txtCD Then 'Do Something End If Catch ex As Exception End Try
←解決時は質問者本人がここをチェックしてください。
更新する
戻る
掲示板システム
Copyright 2021 Takeshi Okamoto All Rights Reserved.