Hey DreamForums,
Currently i'm having an problem with my code its giving error: Object reference not set to an instance of an object. How can i fix this?
[b]FolderDialog:[/
[b]Button:[/b]
[b]CheckPath:[/b]
So what did i do to get the error, I selected the Folder (that has the AuthServer.exe and WorldServer.exe
(File.Exists((ServerPath.Text & "\authserver.exe")) AndAlso File.Exists((ServerPath.Text & "\worldserver.exe")))
Then its says: Line 13 & 14: Object reference not set to an instance of an object So how can i fix this if somebody can give tips or howto i be thankfull
Maikel233.
Currently i'm having an problem with my code its giving error: Object reference not set to an instance of an object. How can i fix this?
[b]FolderDialog:[/
b]
Public Sub New()
Dim fbdserver As FolderBrowserDialog
Dim fbd1apache As FolderBrowserDialog
Dim fbd2mysql As FolderBrowserDialog
Dim fbd3 As FolderBrowserDialog
MyBase.New()
fbdserver = New FolderBrowserDialog
fbd1apache = New FolderBrowserDialog
fbd2mysql = New FolderBrowserDialog
fbd3 = New FolderBrowserDialog
End Sub
[b]Button:[/b]
Private Sub ServerPathButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ServerPathButton.Click
fbdserver.ShowDialog()
If (fbdserver.SelectedPath <> "") Then
ServerPath.Text = fbdserver.SelectedPath
My.MySettings.Default.ServerPath = fbdserver.SelectedPath
My.MySettings.Default.Save()
End If
CheckPaths()
End Sub
[b]CheckPath:[/b]
Private Sub CheckPaths()
If (File.Exists((ServerPath.Text & "\authserver.exe")) AndAlso File.Exists((ServerPath.Text & "\worldserver.exe"))) Then
isServerPathCorrect = True
ServerPath.BackColor = Color.LightGreen
StartWorld.Enabled = True
StartAuth.Enabled = True
StopWorld.Enabled = True
StopAuth.Enabled = True
AutoRestart.Enabled = True
' // Both are Object reference not set to an instance of an object
worldServerInfo.WorkingDirectory = ServerPath.Text
authServerInfo.WorkingDirectory = ServerPath.Text
worldServer.StartInfo = worldServerInfo
authServer.StartInfo = authServerInfo
Else
isServerPathCorrect = False
ServerPath.BackColor = Color.LightCoral
StartWorld.Enabled = False
StartAuth.Enabled = False
StopWorld.Enabled = False
StopAuth.Enabled = False
AutoRestart.Enabled = False
End If
If File.Exists((MySQLPath.Text & "\mysqld.exe")) Then
isMysqlPathCorrect = True
MySQLPath.BackColor = Color.LightGreen
StartMySQL.Enabled = True
StopMySQL.Enabled = True
mySQLInfo.WorkingDirectory = MySQLPath.Text
Else
isMysqlPathCorrect = False
MySQLPath.BackColor = Color.LightCoral
StartMySQL.Enabled = False
StopMySQL.Enabled = False
End If
If File.Exists((ApachePath.Text & "\httpd.exe")) Then
isApachePathCorrect = True
ApachePath.BackColor = Color.LightGreen
StartApache.Enabled = True
StopApache.Enabled = True
apacheInfo.WorkingDirectory = ApachePath.Text
Else
isApachePathCorrect = False
ApachePath.BackColor = Color.LightCoral
StartApache.Enabled = False
StopApache.Enabled = False
End If
End Sub
So what did i do to get the error, I selected the Folder (that has the AuthServer.exe and WorldServer.exe
(File.Exists((ServerPath.Text & "\authserver.exe")) AndAlso File.Exists((ServerPath.Text & "\worldserver.exe")))
Then its says: Line 13 & 14: Object reference not set to an instance of an object So how can i fix this if somebody can give tips or howto i be thankfull
Maikel233.