Quantcast
Channel: Programming Forums
Viewing all articles
Browse latest Browse all 51036

how to store images in memory when upload button clicked?

$
0
0
i hav created a form where there is a button Upload. when user clicks on the button there are multiple images uploaded in the flowlayoutpanel called PhotoGallery wsing openfilediaolgue. what i want is when the user runs the form the uploaded images should be there in the panel. also the path of the image shud appear in the textboxes. in the code below only one textbox appears with a single path. please help
 Private Sub upload_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles upload.Click
        PhotoGallery.Visible = True
        Dim OpenFileDialog1 As New OpenFileDialog
        OpenFileDialog1.Filter = "Images (*.BMP;*.JPG;*.GIF,*.PNG,*.TIFF)|*.BMP;*.JPG;*.GIF;*.PNG;*.TIFF|" + "All files (*.*)|*.*"
        OpenFileDialog1.Multiselect = True
        OpenFileDialog1.Title = "Select Photos"
        Dim strm As System.IO.Stream
        Dim tb As New TextBox
        If OpenFileDialog1.ShowDialog() = DialogResult.OK Then
            For Each file As String In OpenFileDialog1.FileNames
                Dim imageControl As New PictureBox()
                imageControl.Height = 150
                imageControl.Width = 200
                Dim myCallback As New Image.GetThumbnailImageAbort(AddressOf ThumbnailCallback)
                Dim myBitmap As New Bitmap(file)
                Dim myThumbnail As Image = myBitmap.GetThumbnailImage(200, 150, myCallback, IntPtr.Zero)
                imageControl.Image = myThumbnail
                'imageControl.
                PhotoGallery.AutoScroll = True
                PhotoGallery.Controls.Add(imageControl)
                strm = OpenFileDialog1.OpenFile()
                'tb.Size.Equals(384, 20)
                tb.Text = OpenFileDialog1.FileName.ToString()
                PhotoGallery.Controls.Add(tb)

            Next
        End If

        Dim MoveLocation As String
        Dim TransferPath = "D:images"
        Dim imgAdres As String
        Dim fileName

        imgAdres = OpenFileDialog1.FileName
        fileName = System.IO.Path.GetFileName(imgAdres)
        MoveLocation = TransferPath + fileName

        If System.IO.File.Exists(imgAdres) = True Then
            If System.IO.File.Exists(MoveLocation) = False Then
                System.IO.File.Move(imgAdres, MoveLocation)
                'AutosizeImage(MoveLocation, PictureBox1)

            End If
        End If
    End Sub

    Public Function ThumbnailCallback() As Boolean
        Return False
    End Function


Viewing all articles
Browse latest Browse all 51036

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>