06-07-19, 03:06 PM
يبدوا ان مشكلتي لربما هي المسار الذي يتم حفظ بشكل خاطئ
حيث أنني أريد من الكود أخذ صورة من مكان الصورة ونسخها الى مكان محدد , ومن ثم يأخذ المسار الجديد
لربما هناك خطأ فعلا في هذا الكود لانني جربت جميع الحلول لكن دون جدوى
[code]
Private Sub DataGridView1_SelectionChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DataGridView1.SelectionChanged
Try
OpenFileDialog1.Filter = "Images files (*.jpeg; *.jpg;*.tif;*.wmp;*.png;*.gif)|*.JPG|All files (*.*)|*.*"
If OpenFileDialog1.ShowDialog = Windows.Forms.DialogResult.OK Then
Dim imgpath As String = OpenFileDialog1.FileName
Dim imgname As String = System.IO.Path.GetFileName(imgpath)
Dim newpath As String = Application.StartupPath & "\PIC_ARTICLE\" & imgname
PictureBox1.Load(imgpath)
PictureBox1.SizeMode = PictureBoxSizeMode.StretchImage
My.Computer.FileSystem.CopyFile(imgpath, newpath)
End If
Catch ex As Exception
End Try
End Sub
[code/]
حيث أنني أريد من الكود أخذ صورة من مكان الصورة ونسخها الى مكان محدد , ومن ثم يأخذ المسار الجديد
لربما هناك خطأ فعلا في هذا الكود لانني جربت جميع الحلول لكن دون جدوى
[code]
Private Sub DataGridView1_SelectionChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DataGridView1.SelectionChanged
Try
OpenFileDialog1.Filter = "Images files (*.jpeg; *.jpg;*.tif;*.wmp;*.png;*.gif)|*.JPG|All files (*.*)|*.*"
If OpenFileDialog1.ShowDialog = Windows.Forms.DialogResult.OK Then
Dim imgpath As String = OpenFileDialog1.FileName
Dim imgname As String = System.IO.Path.GetFileName(imgpath)
Dim newpath As String = Application.StartupPath & "\PIC_ARTICLE\" & imgname
PictureBox1.Load(imgpath)
PictureBox1.SizeMode = PictureBoxSizeMode.StretchImage
My.Computer.FileSystem.CopyFile(imgpath, newpath)
End If
Catch ex As Exception
End Try
End Sub
[code/]
