尽快将图像从Access访问到Visual Basic / Picturebox或图像/帮助 [英] Importing Images From Access to a Visual Basic /Picturebox or Image/ Help ASAP

查看:137
本文介绍了尽快将图像从Access访问到Visual Basic / Picturebox或图像/帮助的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好我正在做一个AS项目,我必须链接访问visual basic。在我的登录中,需要进行图片确认才能继续。唯一的问题是我尝试的所有东西似乎都没有用。我已经设法从access中的表中导入文本到lable和textbox但是代码是无效的,尽管图像已存储为两者,BMP和Package不会导入。

lblfirstname.Caption = myrs!名字工作
在哪里
picstudent.Picture = myrs!图片不工作
olepicture.picture = myrs!图片无法工作
myrs = recordset

我已经尝试了一切但似乎没有用。有没有人知道是否可以导入这样的项目,或者如果我必须激活或更改任何参考。我已经落后于我的项目,因为我的文件已损坏,我不得不重新启动,所以快速的帮助表示赞赏。
我也似乎无法找到相应的写论坛,如果它在错误的地方通知我正确location:P

解决方案

你好,


我使用Image作为显示图片的方框,图片类型为Linked。


在代码i中,然后将路径和文件名放入image.Picture属性,以显示图片。


我从不在我的数据库中存储图片。我只存储路径和文件名。


事件形式当前的代码示例。


Private Sub Form_Current()

   如果Nz(Me.StaffId)> 0然后

   否则

       退出子

   结束如果是
   如果Len(Me.PictFilename)> 0然后                '检查字段是否有文件名

       如果Len(Dir(Me.PictFilename))> 0然后       '检查文件是否存在

            Me.Picturee.Picture = Me.PictFilename   '更改图像控件的属性

       结束如果是
   结束如果

结束子


希望此帮助


 


      


Hello i am doing an AS project where i must link access to visual basic. In my login a picture confirmation is required to proceed. The only problem is everything that i try doesnt seem to work. Ive managed to import text into a lable and textbox from a table in acces but the code isnt valid eventhough the image which ive stored as both and BMP and Package wont import.

lblfirstname.Caption = myrs!Firstname work
where
picstudent.Picture = myrs!Picture doesnt work
olepicture.picture = myrs!Picture doesnt work
myrs = recordset

Ive tried everything but it doesnt seem to work. does anyone know if its possible to import items like that or if i have to activate or change any refrences. Im already behind on my project because my files were corrupted and i had to restart so fast help is appreciated.
Also i cant seem to find the write forum that would correspond so if its in the wrong place notify me with the correct location :P

解决方案

Hi there,

I use Image as the box to display pictures, with the picture type as Linked.

In code i then put the path and filename into the image.Picture property, to display the picture.

I never store pictures in my database. I only store the path and filename.

Code example under event form current.

Private Sub Form_Current()
    If Nz(Me.StaffId) > 0 Then
    Else
        Exit Sub
    End If
    If Len(Me.PictFilename) > 0 Then                'Check if field has a filename
        If Len(Dir(Me.PictFilename)) > 0 Then       'Check if file exist
            Me.Picturee.Picture = Me.PictFilename   'Change the property of the image control
        End If
    End If
End Sub

Hope this help

 

      


这篇关于尽快将图像从Access访问到Visual Basic / Picturebox或图像/帮助的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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