Display image on pictureBox using the image path stored on DB
Solved/Closed
mikeoe2003
Posts
24
Registration date
Thursday November 1, 2012
Status
Member
Last seen
March 27, 2014
-
Nov 21, 2012 at 03:30 AM
umesh - Feb 9, 2017 at 04:11 AM
umesh - Feb 9, 2017 at 04:11 AM
Related:
- C# picturebox image from file
- Windows 10 iso file download 64-bit - Download - Windows
- Kmspico zip file download - Download - Other
- Download audio file from messenger - Guide
- Dvi file - Guide
- Tiny 11 iso file download - Download - Windows
2 responses
Zohaib R
Posts
2368
Registration date
Sunday September 23, 2012
Status
Member
Last seen
December 13, 2018
69
Nov 22, 2012 at 11:55 AM
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