1. i hve create school system...so when register new student i want to upload their picture in folder,not database...when upload, all student picture will be in same folder like student picture..

2. i'm using listview to view all student information,so i want picture display in listview column..

Recommended Answers

All 2 Replies

On number one i can help you out

BROWSE BUTTON - To Search for the new picture to upload

OpenFileDialog1.Title = "Open File"
        OpenFileDialog1.FileName = String.Empty

        Try

            OpenFileDialog1.InitialDirectory = "C:\"

        Catch ex As Exception

            MessageBox.Show(ex.Message.ToString(), "Error")

        End Try

        OpenFileDialog1.ShowDialog()

        If OpenFileDialog1.FileName = String.Empty Then
            Return
        Else

            txtFileName.Text = OpenFileDialog1.FileName

        End If
        Dim filePath As String = txtFileName.Text
        Dim fnPeices() As String = filePath.Split("\")
        Dim fileName As String = ""

        fileName = fnPeices(fnPeices.Length - 1)
        TextBox1.Text = fileName

UPLOAD BUTTON

My.Computer.Network.UploadFile(txtFileName.Text, My.Settings.rutaido & TextBox1.Text, "", "", True, 500)

My.Settings.rutaido contains the path where i want to save the file, Ex. "C:\Temp\" and Textbox1.Text is the name of the new file that is going to be uploaded

txtFileName.txt, is the full path and file from where the file that you want to is allocated.

the final value in "True" and "500" is for the transfer screen, setting the value to True will show the screen saying that you uploading the file, and the 500 is for the progress update bar refresh rate

the two fields in the between TextBox1.Text & True are the user name and password if needed, Ex.

My.Computer.Network.UploadFile(txtFileName.Text, My.Settings.rutaido & TextBox1.Text, "admin", "123456", True, 500)

Maybe that can help you for now

See if this helps to load images in a ListView.

Public Class Form1
    '// ImageList used to store images for the ListView.
    Private myImageList As New ImageList With {.ColorDepth = ColorDepth.Depth32Bit, .ImageSize = New Size(45, 45)}
    Private myImagesFolder As String = "C:\TEMP" '// Folder containing images.

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        ListView1.LargeImageList = myImageList '// set the ImageList to Listview.
        For Each img As String In My.Computer.FileSystem.GetFiles _
                                            (myImagesFolder, FileIO.SearchOption.SearchTopLevelOnly, "*.png") '// get all .png images from Folder.
            myImageList.Images.Add(Image.FromFile(img)) '// add image to ImageList.
        Next
        '// loop thru all images added to ImageList.
        For i As Integer = 0 To myImageList.Images.Count - 1
            ListView1.Items.Add(New ListViewItem("img " & i + 1, i)) '// add image to ListView. ", i)" is for the image index in your ImageList.
        Next
    End Sub
End Class
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.