hi this is my code for online banking i want to encyrpte the user inputs of code to an xml file that i have created i also want to decrypte the file....below is the code
Imports System.IO
Imports System.Xml
Public Class welcome
Dim pincode As String
Private customers As New ArrayList
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles login.Click
If Me.ShowDialog() = Windows.Forms.DialogResult.OK Then
Dim x As customer.Registrationsex
If customer.Registrationsex.text.Equals("male") Then
x = customer.Registrationsex.male
Else
x = customer.Registrationsex.female()
End If
Dim name As String = Registration.txtname.Text
Dim bankidnum As Short = Short.Parse(Registration.txtbankidnum.Text)
Dim age As Short = Short.Parse(Registration.txtage.Text)
Dim customers As New customer(Name, bankidnum, age, x)
customers.Add(customer)
savedata()
End If
End Sub
'saves the data to an xml file
Private Sub savedata()
Try
Dim data As New XmlDocument
Dim mobile As XmlElement = data.CreateElement("mobile")
data.AppendChild(mobile)
Dim customer As Registration
For Each customer In c
Dim competitor As XmlElement = data.CreateElement("registration")
With competitor
.SetAttribute("name", customer.Name.ToUpper)
Dim num As String
If customer.bankidnum < 10 Then
num = "000" & customer.bankidnum
ElseIf customer.bankidnum < 100 Then
num = "00" & customer.bankidnum
ElseIf customer.bankidnum < 1000 Then
num = "0" & customer.bankidnum
Else
num = customer.bankidnum
End If
.SetAttribute("bankid", num)
.SetAttribute("age", customer.age)
Dim sex As String
If comp.sex.Equals(mobilebanking.registration.registration.Female) Then
sex = "female"
Else
sex = "male"
End If
.SetAttribute("sex", sex)
End With
Dim account As AccountBalance
For Each account In customer.mobilebanking
Dim account As XmlElement = data.CreateElement("account")
With account
.SetAttribute("accountbalance", account.reduce)
.SetAttribute("topup", topup.increase)
'.SetAttribute("accountbalanceIndex", account.balanceindex)
End With
customer.AppendChild(mobilebanking)
Next
mobilebanking.AppendChild(Registration)
Next
data.Save(Application.StartupPath + "\mobile.xml")
Catch ex As Exception
MsgBox("Error saving customer data.", MsgBoxStyle.Critical, "Data Save Error")
End Try
End Sub
'calls the loaddata() method when the program is started
Private Sub Welcome_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
loaddata()
'loads the data from an xml file
End Sub
Private Sub loaddata()
Try
Dim data As New XmlDocument
Dim namelist As XmlNodeList
Dim customernode As XmlNode
data.Load(Application.StartupPath + "\mobile.xml")
namelist = data.SelectNodes("/mobile/registration")
For Each customernode In namelist
Dim name As String = customernode.Attributes.GetNamedItem("name").Value.ToUpper
Dim bankidnum As Short = Short.Parse(customernode.Attributes.GetNamedItem("bankidnum").Value)
Dim age As Short = Short.Parse(customernode.Attributes.GetNamedItem("age").Value)
Dim sex As String = Short.Parse(customernode.Attributes.GetNamedItem("sex").Value)
If customernode.Attributes.GetNamedItem("sex").Value.Equals("male") Then
sex = customer.Registrationsex.male
Else
sex = customer.Registrationsex.female
End If
Dim mycustomer As New customer(name, bankidnum, age, sex)
customers.Add(mycustomer)
Next
Catch ex As Exception
MsgBox("Could not load competitor data.", MsgBoxStyle.Information, "Data Load Error")
End Try
End Sub
Private Sub cancelw_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles exitw.Click
MessageBox.Show(" Thank you for using our services GoodBye") 'When Quit is clicked...
Application.Exit()
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Randomize()
Randomize()
End Sub
Private Sub registerw_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles registerw.Click
Registration.Visible = True
End Sub
Private Sub admin_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles admin.Click
pincode = s.Text
Dim bankmoney As String
If pincode = ("mohammed") Then 'mohammed
Mobilebankingm.Visible = False
MsgBox("welcome " + pincode + " to your mobile banking world")
Mobilebankingm.Visible = False
Administration.Visible = True
bankmoney = 500 + Rnd()
End If
End Sub
End Class