Picturebox save in settings (alternative method)

Heres your chance to share your own tutorials with the community. Just post them on here. If your lucky they may even be posted on the main site.
3 posts Page 1 of 1
Contributors
User avatar
upperdrag
Excellent Poster
Excellent Poster
Posts: 321
Joined: Fri Mar 12, 2010 12:05 pm

Ok Base on mark's tutorial request, i decided to make this

Image


Image


Image


Code: Select all
Public Class Form1

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        TextBox1.Text = My.Settings.pictureurl
      
        On Error Resume Next
        PictureBox1.Image = System.Drawing.Image.FromFile(TextBox1.Text)
    End Sub

    Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
     
    End Sub

    Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged
        My.Settings.pictureurl = TextBox1.Text
        On Error Resume Next
        PictureBox1.Image = System.Drawing.Image.FromFile(TextBox1.Text)
        My.Settings.Save()
    End Sub


    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim openfiledialog1 As New OpenFileDialog
        openfiledialog1.FileName = "Image"
        openfiledialog1.Filter = "Image|*.png"
        If (openfiledialog1.ShowDialog() = Windows.Forms.DialogResult.OK) Then
            PictureBox1.Image = System.Drawing.Image.FromFile(openfiledialog1.FileName)
            TextBox1.Text = (openfiledialog1.FileName)

        End If
    End Sub

End Class
User avatar
XTechVB
VIP - Site Partner
VIP - Site Partner
Posts: 727
Joined: Thu May 20, 2010 10:32 am

very helpful for beginners. Nice Post
if you want to see true advanced use of the settings take a look at my Advanced Photo Viewer viewtopic.php?f=38&t=2304 and tell me what you think
You can find me on Facebook or on Skype mihai_92b
User avatar
upperdrag
Excellent Poster
Excellent Poster
Posts: 321
Joined: Fri Mar 12, 2010 12:05 pm

nice nice . :D
3 posts Page 1 of 1
Return to “Tutorials”