Hi all,
I'm hoping someone can help me with this as I can't for the life of me figure it out.
I have a single form called 'FolderSelector' with a label, textbox and a button.
The problem I'm having is that everytime I run the application, the only thing that shows up is a blank form called 'Form1', the program runs everything it should do except to show the actual form which is really weird.
Here's the code in case there's something in there that's causing it that I haven't spotted.
Imports System.IO.Directory
Public Class FolderSelector
Public Const SPI_SETDESKWALLPAPER As Integer = &H14
Public Const SPIF_UPDATEINIFILE As Integer = &H1
Public Const SPIF_SENDWININICHANGE As Integer = &H2
Public Declare Auto Function SystemParametersInfo Lib "user32.dll" (ByVal uAction As Integer, ByVal uParam As Integer, ByVal lpvParam As String, ByVal fuWinIni As Integer) As Integer
Private Sub FolderSelector_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
TaskTrayIcon.Visible = False
Dim rightNow As DateTime = DateTime.Now
Dim strCurrentDateTimeStringYear As String
Dim strCurrentDateTimeStringMonth As String
strCurrentDateTimeStringYear = rightNow.ToString("yyyy")
strCurrentDateTimeStringMonth = rightNow.ToString("MMMM")
Dim imageLocation As String
imageLocation = "D:\Images\Calendar\" & strCurrentDateTimeStringYear & "\" & strCurrentDateTimeStringMonth & ".jpg"
Try
SystemParametersInfo(SPI_SETDESKWALLPAPER, 1, imageLocation, SPIF_UPDATEINIFILE Or SPIF_SENDWININICHANGE)
Catch Ex As Exception
MsgBox("There was an error setting the wallpaper: " & Ex.Message)
End Try
End Sub
Private Sub NotifyIcon1_MouseDoubleClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles TaskTrayIcon.MouseDoubleClick
Try
Me.Show()
Me.WindowState = FormWindowState.Normal
TaskTrayIcon.Visible = False
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub
Private Sub FolderSelector_Resize(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Resize
Try
If Me.WindowState = FormWindowState.Minimized Then
Me.WindowState = FormWindowState.Minimized
TaskTrayIcon.Visible = True
Me.Hide()
End If
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub
Private Sub DateCheck_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DateCheck.Tick
Dim rightNow As DateTime = DateTime.Now
Dim strCurrentDateTimeStringYear As String
Dim strCurrentDateTimeStringMonth As String
strCurrentDateTimeStringYear = rightNow.ToString("yyyy")
strCurrentDateTimeStringMonth = rightNow.ToString("MMMM")
Dim imageLocation As String
imageLocation = "D:\Images\Calendar\" & strCurrentDateTimeStringYear & "\" & strCurrentDateTimeStringMonth & ".jpg"
Try
SystemParametersInfo(SPI_SETDESKWALLPAPER, 1, imageLocation, SPIF_UPDATEINIFILE Or SPIF_SENDWININICHANGE)
Catch Ex As Exception
MsgBox("There was an error setting the wallpaper: " & Ex.Message)
End Try
End Sub
Private Sub btnBrowse_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnBrowse.Click
Dim MyFolderBrowser As New System.Windows.Forms.FolderBrowserDialog
' Descriptive text displayed above the tree view control in the dialog box
MyFolderBrowser.Description = "Select the Folder"
' Do not show the button for new folder
MyFolderBrowser.ShowNewFolderButton = False
Dim dlgResult As DialogResult = MyFolderBrowser.ShowDialog()
If dlgResult = Windows.Forms.DialogResult.OK Then
txtFolder.Text = MyFolderBrowser.SelectedPath
End If
End Sub
End Class
Thanks
TheMightySpud