C# と VB.NET の質問掲示板

わんくま同盟

ASP.NET、C++/CLI、Java 何でもどうぞ

C# と VB.NET の入門サイト


(過去ログ 170 を表示中)
■98301 / )  Re[2]: Buttonのフォーカス?表示を維持するには
□投稿者/ ゆい (14回)-(2021/10/29(Fri) 20:34:16)
No98299 (furu さん) に返信

ありがとうございます。
これがピッタリのような気がします。

ラジオボタン(RadioButton1、RadioButton1)と同様なことが、
ボタン(Button3)でも出来るのでしょうか?

即ち、RadioButton1、RadioButton1、Button3のどれかが押されてもです。


> フォーカスのあったボタンを覚えておいて
> ラジオボタンの処理が終わったら
> フォーカスを戻してはどうでしょうか?
>
> Dim ActiveButton As Button
>
> Private Sub Button1_Validating(sender As Object, e As System.ComponentModel.CancelEventArgs) Handles Button1.Validating, Button2.Validating
> If TypeOf ActiveControl Is RadioButton Then
> ActiveButton = sender
> End If
> End Sub
>
> Private Sub RadioButton1_Click(sender As Object, e As EventArgs) Handles RadioButton2.Click, RadioButton1.Click
> If Not (ActiveButton Is Nothing) Then
> ActiveButton.Focus()
> ActiveButton = Nothing
> End If
> End Sub
返信 編集キー/


管理者用

- Child Tree -