如何访问将在运行时创建的按钮

如何访问将在运行时创建的按钮

本文介绍了如何访问将在运行时创建的按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有将在运行时创建的按钮.所以我应该能够用代码移动那个按钮.为此,我知道我应该使用

i have buuttons which are going to be created at runtime. so i should be able to move that buttons with code. for that i know i should use

Private Sub Runtime Button Name_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles User.MouseDown


同样,我应该使用鼠标移动"和鼠标向上"事件.


这里的问题是我不了解如何命名运行时按钮,因此我应该能够移动该按钮.

请帮助我如何命名在运行时创建的按钮.


Similarly i should use Mouse Move and Mouse Up Events.


Problem here is I am not understanding how to name the runtime button so that i should be able to move that button.

Please help me how to name the button which is created at runtime.

推荐答案

Dim b As Button = TryCast(sender, Button)
If b IsNot Nothing Then
    Dim text As String = b.Text
End If


这篇关于如何访问将在运行时创建的按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-21 10:42