如何在vb.net中动态删除创建控件? [英] How to remove dynamically create control in vb.net ?

查看:390
本文介绍了如何在vb.net中动态删除创建控件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hai

如何从vb表单中动态创建图片框?通过指定需要从表单中删除控件的名称或文本,

实际上我将动态创建图片框并且它会点击我将得到名称,使用该名称我需要删除control.if代码执行相同的图片它没有删除,所以需要捕获全局变量中的名称,执行后点击事件可以删除控件吗?







问候

Aravind

Hai
How to remove dynamically create picture box from vb form ? by specify the name or text need to remove control from form ,
Actually i will create picture box dynamically and its rigth click i will get name ,using that name i need to remove control.if code execute in same picture it not remove,so need to capture name in global variable and after execute click event can remove control ?



Regards
Aravind

推荐答案

当您右键单击控件时,处理程序方法将传递给 sender 参数。

您可以使用 Controls.Remove [ ^ ]通过将该实例传递给方法来从表单中删除控件。
When you right click on the control, the handler method is passed the instance in the sender parameter.
You can use Controls.Remove[^] to remove the control from your form by passing that instance to the method.


这篇关于如何在vb.net中动态删除创建控件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆