run time back ground image change of mdi form

  • Thread starter Thread starter Kalpesh915
  • Start date Start date
K

Kalpesh915

Guest
hello,

i am creating a application for Student management system vb.net framework 3.5 with using MdiParent form and Child Forms,

i want to Run time change background image of MdiParent form but coded as below but it not work properly,

when i change the image program closed automatically with errors.


Code is :


Private Sub ChangeWallpaperToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ChangeWallpaperToolStripMenuItem.Click
OpenFileDialog1.ShowDialog()
Dim photo, dest As String
photo = OpenFileDialog1.FileName
dest = "images\wallpaper.jpg"


MsgBox(photo)
MsgBox(dest)

If System.IO.File.Exists("images\wallpaper.jpg") Then
BackgroundImage = Image.FromFile("images\tmp.jpg")
System.IO.File.Delete("images\wallpaper.jpg")
System.IO.File.Copy(photo, dest)
BackgroundImage = Image.FromFile("images\wallpaper.jpg")
Else
System.IO.File.Copy(photo, dest)
BackgroundImage = Image.FromFile("images\wallpaper.jpg")
End If
End Sub


so i want help......

Continue reading...
 
Back
Top