' recently added to see if it would help
Imports System Imports System.Xml
Imports System.Xml.Serialization
Imports System.IO
Imports Microsoft.VisualBasic
'it didnt
Public Class mnuBotConfig
Inherits System.Windows.Forms.Form
Private Sub Label1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
End Sub
Private Sub GroupBox1_Enter(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles GroupBox1.Enter
End Sub
Private Sub RadioButton1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Starcraft_Product.CheckedChanged
End Sub
Private Sub RadioButton7_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles WarCraftIIITFT_Product.CheckedChanged
End Sub
Private Sub GroupBox3_Enter(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles GroupBox3.Enter
End Sub
Private Sub Apply_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Apply.Click
'Save the updated user credentials.
'Load the user credentials.
Dim currentUser As UserCredentials = Me.LoadUserCredentials()
currentUser.UserName = Me.UserName.Text
currentUser.Password = Me.password.Text
Me.SaveUserCredentials(currentUser)
End Sub
Private Sub Cancel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Cancel.Click
Me.Close()
End Sub
Private Sub mnuBotConfig_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'Load the user credentials.
Dim currentUser As UserCredentials = Me.LoadUserCredentials()
'Populate the text boxes with the user credentials.
Me.UserName.Text = currentUser.UserName
Me.password.Text = currentUser.Password
'Do whatever.
End Sub
Private Sub Options_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Options.Click
Dim Options As New options
Options.Show()
Me.Close()
End Sub
Private Sub password_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles password.TextChanged
End Sub
'Save UserCedentials
Private Sub SaveUserCredentials(ByVal userame As UserCredentials)
'The object that performs the serialization.
Dim serializer As New Xml.Serialization.XmlSerializer(GetType(UserCredentials))
'The object that creates the file.
Dim stream As New IO.FileStream(Application.StartupPath & IO.Path.DirectorySeparatorChar & "UserCredentials.xml", IO.FileMode.Create)
'Convert the object to XML.
serializer.Serialize(stream, UserName)
'Close the file.
stream.Close()
End Sub
'Load UserCredentials
Private Function LoadUserCredentials() As UserCredentials
Dim userPath As String = Application.StartupPath & IO.Path.DirectorySeparatorChar & "UserCredentials.xml"
If System.IO.File.Exists(userPath) Then
'The object that performs the serialization.
Dim serializer As New Xml.Serialization.XmlSerializer(GetType(UserCredentials))
'The object that opens the file.
Dim stream As New IO.FileStream(userPath, IO.FileMode.Open)
'Convert the XML to an object.
'Each function has a local variable of the same name and type that can be assigned to rather than using Return.
LoadUserCredentials = serializer.Deserialize(stream)
'Close the file.
stream.Close()
Else
'You can create a new object with default values if no file exists.
Return New UserCredentials
End If
End Function
Private Sub UserName_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles UserName.TextChanged
End Sub
End Class