如何在运行时卸载或清空图片框? [英] How can unload or empty picture box at run time?

查看:89
本文介绍了如何在运行时卸载或清空图片框?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我在按钮单击事件中使用clear()方法,将数据保存到数据库中后,clear()方法将自动调用.clear()方法包含以下代码.


I use a clear() method in button click event, after save a data in a database the clear() method will call automatically.The clear() method contains the following codes.

txtName.Text = "";
          txtAddress.Text = "";
          txtPhoneNo.Text = "";
          cmbQualification.SelectedIndex = 0;
          cmbStream.SelectedIndex = 0;
          cmbJobType.SelectedIndex = 0;
          dtpDtaeofApply.Value = DateTime.Now;
          cmbLocation.SelectedIndex = 0;
          cmbSubLocationInd.SelectedIndex = 0;
          cmbSubLocationFgn.SelectedIndex = 0;
          txtPassPortNo.Text = "";
          txtAmount.Text = "";
          txtCharge.Text = "";




现在我的问题是,在我的按钮单击事件中,我在图片框中添加图像,保存到数据库中后,将调用clear()方法.那时,该图片框应为unload(empty).如何做到这一点?请帮助我.


我从你那里得到了答案,

picturebox1.image = null;

这行不是从图片框中卸载图像..请帮助..

谢谢,
Viswanathan.M




Now my question is, In my button click event , i add image in picture box, after saved in a database, the clear() method will call.At that time, that picture box should be unload(empty).How can do this? Kindly help me..


I got answer from you like this,

picturebox1.image=null;

This line is not unload the image from picture box..Kindly help..

Thanks,
Viswanathan.M

推荐答案

将控件中的图像设置为空
Set the image in the control to null


尝试一下.
Try this.
PictureBox1.Image.Dispose();
PictureBox1.Image = null


这篇关于如何在运行时卸载或清空图片框?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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