EDN Admin
Well-known member
Hello again,
I have a rather big problem: I have an add-on for my program (Developer Mode) which can be installed to a separate path as the main program. There is a log-in form, which should detect if the setting DevMode equals nothing or not. And if it does, then a message box shows up, asking the user if if a custom path should be used for installation, or not. If so, a FolderBrowserDialog shows up, allowing the selection of a path. But that does not show up. Ive tried this in release- and debug-mode and both arent working.
If you have some time to spare, here is the code.Private Sub LogInToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles LogInToolStripMenuItem.Click
Dim DevModePath As String = My.Settings.DevMode
If DevModePath = Nothing Then
If MessageBox.Show("This is the first time youre starting the Developer Mode. Would you like to use a custom path to save the Developer Mode to?", processName, MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) = Windows.Forms.DialogResult.Yes Then
Dim FolderBr As New FolderBrowserDialog
FolderBr.Description = "Select the folder where you want the Developer Mode to be installed to:"
FolderBr.ShowNewFolderButton = True
Dim DialogRes As DialogResult = FolderBr.ShowDialog
If DialogRes = Windows.Forms.DialogResult.OK Then
My.Settings.DevMode = FolderBr.SelectedPath
My.Settings.Save()
My.Computer.Registry.SetValue(RegVal2, "DevModePath", FolderBr.SelectedPath)
Try
If Not Directory.Exists("C:Universal_Android_KitDevMode") Then
Directory.CreateDirectory("C:Universal_Android_KitDevMode")
End If
If Not File.Exists("C:Universal_Android_KitDevModeDevMode_Loc.Location") Then
File.Create("C:Universal_Android_KitDevModeDevMode_Loc.Location")
End If
File.WriteAllText(My.Settings.DevMode, "C:Universal_Android_KitDevModeDevMode_Loc.Location")
Catch ex As Exception
If Not File.Exists("C:Universal_Android_KitAppFilesLogsForm1.DevMode_Locate.log") Then
File.Create("C:Universal_Android_KitAppFilesLogsForm1.DevMode_Locate.log")
End If
File.WriteAllText(ex.ToString, "C:Universal_Android_KitAppFilesLogsForm1.DevMode_Locate.log")
MessageBox.Show("Oops! Something went wrong! This is the exception that was thrown: " & ex.ToString & vbNewLine & vbNewLine & "The error has been written to a log file.", processName, MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1)
End Try
End If
Else
MessageBox.Show("The default path will be used!", processName, MessageBoxButtons.OK, MessageBoxIcon.Asterisk, MessageBoxDefaultButton.Button1)
My.Settings.DevMode = "C:Universal_Android_KitDevMode"
If Not Directory.Exists(My.Settings.DevMode) Then
Directory.CreateDirectory(My.Settings.DevMode)
End If
End If
Log_In_DeveloperMode.Show()
Me.Hide()
Else
Log_In_DeveloperMode.Show()
Me.Hide()
End If
End Sub
Any ideas what could be wrong?
Thanks in advance for your time and help!
Edit: I have modified the code, originally it was: If My.Settings.DevMode = Nothing Then (..). I changed this hoping it would make a difference, which it did not.
View the full article
I have a rather big problem: I have an add-on for my program (Developer Mode) which can be installed to a separate path as the main program. There is a log-in form, which should detect if the setting DevMode equals nothing or not. And if it does, then a message box shows up, asking the user if if a custom path should be used for installation, or not. If so, a FolderBrowserDialog shows up, allowing the selection of a path. But that does not show up. Ive tried this in release- and debug-mode and both arent working.
If you have some time to spare, here is the code.Private Sub LogInToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles LogInToolStripMenuItem.Click
Dim DevModePath As String = My.Settings.DevMode
If DevModePath = Nothing Then
If MessageBox.Show("This is the first time youre starting the Developer Mode. Would you like to use a custom path to save the Developer Mode to?", processName, MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) = Windows.Forms.DialogResult.Yes Then
Dim FolderBr As New FolderBrowserDialog
FolderBr.Description = "Select the folder where you want the Developer Mode to be installed to:"
FolderBr.ShowNewFolderButton = True
Dim DialogRes As DialogResult = FolderBr.ShowDialog
If DialogRes = Windows.Forms.DialogResult.OK Then
My.Settings.DevMode = FolderBr.SelectedPath
My.Settings.Save()
My.Computer.Registry.SetValue(RegVal2, "DevModePath", FolderBr.SelectedPath)
Try
If Not Directory.Exists("C:Universal_Android_KitDevMode") Then
Directory.CreateDirectory("C:Universal_Android_KitDevMode")
End If
If Not File.Exists("C:Universal_Android_KitDevModeDevMode_Loc.Location") Then
File.Create("C:Universal_Android_KitDevModeDevMode_Loc.Location")
End If
File.WriteAllText(My.Settings.DevMode, "C:Universal_Android_KitDevModeDevMode_Loc.Location")
Catch ex As Exception
If Not File.Exists("C:Universal_Android_KitAppFilesLogsForm1.DevMode_Locate.log") Then
File.Create("C:Universal_Android_KitAppFilesLogsForm1.DevMode_Locate.log")
End If
File.WriteAllText(ex.ToString, "C:Universal_Android_KitAppFilesLogsForm1.DevMode_Locate.log")
MessageBox.Show("Oops! Something went wrong! This is the exception that was thrown: " & ex.ToString & vbNewLine & vbNewLine & "The error has been written to a log file.", processName, MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1)
End Try
End If
Else
MessageBox.Show("The default path will be used!", processName, MessageBoxButtons.OK, MessageBoxIcon.Asterisk, MessageBoxDefaultButton.Button1)
My.Settings.DevMode = "C:Universal_Android_KitDevMode"
If Not Directory.Exists(My.Settings.DevMode) Then
Directory.CreateDirectory(My.Settings.DevMode)
End If
End If
Log_In_DeveloperMode.Show()
Me.Hide()
Else
Log_In_DeveloperMode.Show()
Me.Hide()
End If
End Sub
Any ideas what could be wrong?
Thanks in advance for your time and help!
Edit: I have modified the code, originally it was: If My.Settings.DevMode = Nothing Then (..). I changed this hoping it would make a difference, which it did not.
View the full article