Display image on pictureBox using the image path stored on DB
Solved/Closed
mikeoe2003
umesh - Feb 9, 2017 at 04:11 AM
- Posts
- 25
- Registration date
- Thursday November 1, 2012
- Status
- Member
- Last seen
- March 27, 2014
umesh - Feb 9, 2017 at 04:11 AM
Related:
- Display image on pictureBox using the image path stored on DB
- Excel display image from file path - Guide
- Insert picture in Excel macro which takes the file name refrence - Forum - Excel
- How to display image in c program ✓ - Forum - Programming
- Display image response.binarywrite ✓ - Forum - Programming
- Saving image path to access database and retrieving images ✓ - Forum - Programming
2 replies
Zohaib R
Nov 22, 2012 at 11:55 AM
- Posts
- 2368
- Registration date
- Sunday September 23, 2012
- Status
- Member
- Last seen
- December 13, 2018
Nov 22, 2012 at 11:55 AM
Hi mikeoe2003,
Create a form with the controls shown in the below mentioned image:
http://img43.imageshack.us/img43/4668/formsh.jpg
Create a Database with the name Databasemikeoe2003PictureApplication.mdb (see the image below for the design of the Database):
http://img846.imageshack.us/img846/6905/databaseb.jpg
Paste the below mentioned code in the Click event of ButtonSelect:
Dim cnn As New OleDb.OleDbConnection
cnn = New OleDb.OleDbConnection
cnn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=Databasemikeoe2003PictureApplication.mdb;"
If cnn.State = ConnectionState.Open Then
cnn.Open()
End If
Dim da As New OleDb.OleDbDataAdapter("SELECT * FROM Tablemikeoe2003PictureApplication WHERE Id = " & TextBoxPictureID.Text, cnn)
Dim dt As New DataTable
da.Fill(dt)
Me.TextBoxPictureFilePath.Text = dt.Rows(0).Item("PicturePath")
cnn.Close()
PictureBox1.Image = System.Drawing.Bitmap.FromFile(TextBoxPictureFilePath.Text)
Run the application and check for the results.
Do reply with results.
Create a form with the controls shown in the below mentioned image:
http://img43.imageshack.us/img43/4668/formsh.jpg
Create a Database with the name Databasemikeoe2003PictureApplication.mdb (see the image below for the design of the Database):
http://img846.imageshack.us/img846/6905/databaseb.jpg
Paste the below mentioned code in the Click event of ButtonSelect:
Dim cnn As New OleDb.OleDbConnection
cnn = New OleDb.OleDbConnection
cnn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=Databasemikeoe2003PictureApplication.mdb;"
If cnn.State = ConnectionState.Open Then
cnn.Open()
End If
Dim da As New OleDb.OleDbDataAdapter("SELECT * FROM Tablemikeoe2003PictureApplication WHERE Id = " & TextBoxPictureID.Text, cnn)
Dim dt As New DataTable
da.Fill(dt)
Me.TextBoxPictureFilePath.Text = dt.Rows(0).Item("PicturePath")
cnn.Close()
PictureBox1.Image = System.Drawing.Bitmap.FromFile(TextBoxPictureFilePath.Text)
Run the application and check for the results.
Do reply with results.
Mar 31, 2014 at 09:05 AM
But you done the superb job. Heads off to you
quite smile
Thank you soo much
Apr 4, 2015 at 11:29 AM
thankyou
Dec 24, 2015 at 04:41 AM