保存记录时如何插入图片 [英] How to insert picture while saving record

查看:80
本文介绍了保存记录时如何插入图片的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个带有6个图片框的表格...我想要更新记录...

我想做>>>>>如果picturebox1没有图像,则从c:\ image.jpg加载图片...所有图片框的条件相同...

I have one form with 6 picture boxes... I want to update record...
I want to do >>>>> if picturebox1 has no image then load image from c:\image.jpg... same condition for all picture boxes...

If picturebox1.image is nothing then
   picturebox1.Image = System.Drawing.Image.FromFile("C:\image.Jpg")
elseif picturebox2.image is nothing then
   picturebox2.Image = System.Drawing.Image.FromFile("C:\image.Jpg")
elsif picturebox3.image is nothing then
   picturebox3.Image = System.Drawing.Image.FromFile("C:\image.Jpg")
elseif picturebox4.image is nothing then
   picturebox4.Image = System.Drawing.Image.FromFile("C:\image.Jpg")
elseif picturebox5.image is nothing then
   picturebox5.Image = System.Drawing.Image.FromFile("C:\image.Jpg")
elseif picturebox6.image is nothing then
   picturebox6.Image = System.Drawing.Image.FromFile("C:\image.Jpg")
else
   update condition
endif





但这不起作用......请帮忙......



but this is not working... please help...

推荐答案

这不行对我来说并不是很有帮助。



但是...猜测(因为你没有告诉我们你做了什么,你没有想到,或者你没有做到这一点,那就是我们所能做的全部),它会停止添加图像时它符合第一个非null。



所以你可能想要的是摆脱elseif部分:

"this is not working" is not exactly helpful.

But...at a guess (and since you don't tell us what it is doing that you didn't expect, or doing that you didn't, that's pretty much all we can do) it sill stop "adding images" when it meets the first non-null.

So what you probably want is to get rid of the elseif parts:
If picturebox1.image Is Nothing Then
   picturebox1.Image = System.Drawing.Image.FromFile("C:\image.Jpg")
EndIf
If picturebox2.image Is Nothing Then
   ...

依此类推。

如果所有六张图片都预先加载,它只会在当前进行更新。

And so forth.
It will only do the update at present if all six images are "loaded" in advance.


这篇关于保存记录时如何插入图片的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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