Private Sub Form1_Load(sender As Object, e As EventArgs)
End Sub
Private Sub button1_Click(sender As Object, e As EventArgs)
Dim myWebClient As New WebClient()
Dim fileName As String = textBox1.Text
Dim _path As String = Application.StartupPath
MessageBox.Show(_path)
_path = _path.Replace("Debug", "Images")
MessageBox.Show(_path)
myWebClient.UploadFile(_path, fileName)
End Sub
Private Sub btnBrowse_Click(sender As Object, e As EventArgs)
Dim ofDlg As New OpenFileDialog()
ofDlg.Filter = "JPG|*.jpg|GIF|*.gif|PNG|*.png|BMP|*.bmp"
If DialogResult.OK = ofDlg.ShowDialog() Then
textBox1.Text = ofDlg.FileName
button1.Enabled = True
Else
MessageBox.Show("Go ahead, select a file!")
End If
End Sub
Private Sub textBox1_TextChanged(sender As Object, e As EventArgs)
If textBox1.Text = "" Then
button1.Enabled = False
End If
End Sub
Using myConnection As New OleDbConnection(strConnection)
myConnection.Open()
Dim strSql As String = "SELECT PICTURE FROM MT_IMAGE"
Try
Using myCommand As New OleDbCommand(strSql, myConnection)
myCommand.CommandType = CommandType.Text
Using myDataReader As OleDbDataReader = myCommand.ExecuteReader()
myDataReader.Read()
Dim ImageBytes As Byte() = CType(myDataReader(0), Byte())
Dim ms As New MemoryStream(ImageBytes)
Dim img As Image = Image.FromStream(ms)
picShow.Image = img
End Using
End Using
Catch ex As Exception
MessageBox.Show(ex.Message, "Error")
End Try
End Using