473,508 Members | 2,475 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to browse MDB file in DataGridView and TIF Images in ImageViewer?

9 New Member
Expand|Select|Wrap|Line Numbers
  1. Imports System.IO
  2. Imports System.Data
  3. Imports System.Data.OleDb
  4. Imports Microsoft.VisualBasic
  5.  
  6.  
  7. Public Class CARD_DECK_ENTRY Public myConString As String Dim con As New OleDb.OleDbConnection Dim myStream As Stream = Nothing
  8.  
  9. Private Sub ExitToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ExitToolStripMenuItem.Click
  10.     End
  11.     Operator_ID.Close()
  12. End Sub
  13.  
  14. Private Sub OpenFileToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OpenFileToolStripMenuItem.Click
  15.  
  16.     Dim openFileDialog1 As New OpenFileDialog()
  17.  
  18.     openFileDialog1.InitialDirectory = "c:\"
  19.     openFileDialog1.Filter = "mdb files (*.mdb)|*.mdb|All files (*.*)|*.*"
  20.     openFileDialog1.FilterIndex = 1
  21.     openFileDialog1.RestoreDirectory = True
  22.  
  23.  
  24.     If openFileDialog1.ShowDialog() = System.Windows.Forms.DialogResult.OK Then
  25.         Try
  26.             myStream = openFileDialog1.OpenFile()
  27.             If (myStream IsNot Nothing) Then
  28.                 myConString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & openFileDialog1.FileName
  29.                 Dim x As String = openFileDialog1.FileName.Substring(0, openFileDialog1.FileName.Length - 20) & "Images"
  30.                 con.ConnectionString = myConString
  31.                 con.Open()
  32.  
  33.                 datagridshow()
  34.             End If
  35.         Catch Ex As Exception
  36.             MessageBox.Show("Cannot read file from disk. Original error: " & Ex.Message)
  37.         Finally
  38.             ' Check this again, since we need to make sure we didn't throw an exception on open. 
  39.  
  40.             If (myStream IsNot Nothing) Then
  41.                 myStream.Close()
  42.             End If
  43.         End Try
  44.     End If
  45.  
  46. End Sub
  47.  
  48.  
  49. Private Sub CARD_DECK_ENTRY_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
  50.  
  51.     con.ConnectionString = myConString
  52.  
  53.     con.Open()
  54.  
  55.     datagridshow()
  56.  
  57. End Sub
  58.  
  59. Private Sub datagridshow()
  60.     Dim ds As New DataSet
  61.     Dim dt As New DataTable
  62.     ds.Tables.Add(dt)
  63.     Dim da As New OleDbDataAdapter
  64.  
  65.     da = New OleDbDataAdapter("Select * from Data001", con)
  66.     da.Fill(dt)
  67.  
  68.     DataGridView1.DataSource = dt.DefaultView
  69.  
  70.     con.Close()
  71.  
  72.  
  73. End Sub
---

The above codes was to browse an MDB file and it worked, but now i'm about to load the images into a imageViewer with same time on browsing mdb. As you can see in the above codes, there was ("Select * from Data001", con) because it was a table I will be showing on the DataGridView. On the database there was a two table, those are "CardDeck" and "Data001." In CardDeck there was a "Image001" column. This column contains tif image names. On the folder where the database was found there was another folder on the same path(path of the database folder) named "Images". The column value of "Image001" will be found there. My point is how can I browse those "Image001" column value to a ImageViewer where those value are located in Folder "Images"? Please help. :'(
Jan 28 '16 #1
0 985

Sign in to post your reply or Sign up for a free account.

Similar topics

0
959
by: ktenney | last post by:
Howdy, I've written some code which manipulates images, now I want an interface for choosing images. I'm curious what people might recommend as the easiest way framework to do the following:...
3
3465
by: Dalan | last post by:
At first I was not certain what could cause Access 97 from displaying most jpeg images, but not all. After further testing, it seemed that all original images of less than 275 pixels per inch or...
2
2172
by: Anita C | last post by:
Hi, On the click of a button I want to be able to display a dialog so that a file can be picked , the name of which needs to be passed to a function as a parameter in my asp.net app.. However for...
3
1453
by: Darren | last post by:
Hi, I am not an experienced PHP programmer and have look on the net for what I want to do. I'd like to allow the user on my website to upload two images one is to be turned into a thumbnail...
3
5391
by: den 2005 | last post by:
Hi everybody, I like to allow user to select and browse to which location to save the pdf file of a crystal report viewed on a web page, how can i do this in ASP.Net? I need to get the path...
1
1170
by: Ashok | last post by:
Hi, I would like to seek your help to get more understanding of how to concert a htm file (with images) to a word or excel file using vb.net programe. Appreciate if anyone can give the code...
3
5199
by: ApexData | last post by:
I am using code from the following links to establish a Browse File and Browse Folder dialog. http://www.mvps.org/access/api/api0001.htm http://www.mvps.org/access/api/api0002.htm This code...
0
959
by: shabana | last post by:
hi, i wrote a code to display image from a file using adsp imageviewer, Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click ...
3
2978
by: prashantdixit | last post by:
Hi, I have a form "FormA" which three browse button and texbox control. There two radio buttons at the top with option option1: Auto option2: Manual These option decides how to select a...
1
2766
by: mayankshri | last post by:
hi, I am open a word file from open dialog box in rich text box. i am using this code it open a word file but shows only text .i want to open file with text,images and bullets. ...
0
7133
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7405
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7066
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7504
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
5059
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4724
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
1568
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
773
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
435
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.