daily pastebin goal
29%
SHARE
TWEET

Untitled

a guest Jan 23rd, 2019 69 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Option Explicit On 'this says i must declare as a variable before i can use it
  2.  
  3. Public Class Form1
  4.     'Global Variables
  5.     Dim decFirstNumber As Decimal
  6.     Dim decSecondNumber As Decimal
  7.     Dim decthirdNumber As Decimal
  8.     Dim decforthNumber As Decimal
  9.     Dim decfifthNumber As Decimal
  10.     Dim decsixthNumber As Decimal
  11.     Dim decseventhNumber As Decimal
  12.     Dim deceighthNumber As Decimal
  13.     Dim decTotal As Decimal
  14.     Dim SaveMyFile As String
  15.     Dim Savelocation As String
  16.  
  17.     Private Sub butLOAD_Click(sender As Object, e As EventArgs) Handles butLOAD.Click
  18.  
  19.         'load the saved data
  20.         ' Call ShowDialog.
  21.         Dim a = New OpenFileDialog()
  22.         Dim result As DialogResult = a.ShowDialog()
  23.  
  24.         ' Test result.
  25.         If result = DialogResult.OK Then
  26.             Try
  27.                 SaveMyFile = My.Computer.FileSystem.ReadAllText(a.FileName)
  28.                 Dim number = SaveMyFile.Split(",")
  29.                 TxtGBP.Text = number(0)
  30.                 txtUSD.Text = number(1)
  31.                 txtEUR.Text = number(2)
  32.                 txtYUAN.Text = number(3)
  33.                 txtCAD.Text = number(4)
  34.                 txtAUS.Text = number(5)
  35.                 txtBIT.Text = number(6)
  36.                 txtMEX.Text = number(7)
  37.             Catch ex As Exception
  38.                 MsgBox("Could not open the file due to the following error:" & vbCrLf & ex.Message)
  39.             End Try
  40.         End If
  41.     End Sub
  42.  
  43.     Private Sub butSAVE_Click(sender As Object, e As EventArgs) Handles butSAVE.Click
  44.         'Inputs
  45.         decFirstNumber = Val(TxtGBP.Text)
  46.         decSecondNumber = Val(txtUSD.Text)
  47.         decthirdNumber = Val(txtEUR.Text)
  48.         decforthNumber = Val(txtYUAN.Text)
  49.         decfifthNumber = Val(txtCAD.Text)
  50.         decsixthNumber = Val(txtAUS.Text)
  51.         decseventhNumber = Val(txtBIT.Text)
  52.         deceighthNumber = Val(txtMEX.Text)
  53.         'Processing
  54.  
  55.  
  56.         SaveMyFile = decFirstNumber & "," & decSecondNumber & "," & decthirdNumber & "," & decforthNumber & "," & decfifthNumber & "," & decsixthNumber & "," & decseventhNumber & "," & deceighthNumber & ""
  57.  
  58.         'Outputs
  59.         MsgBox(SaveMyFile) 'shows the outputs
  60.  
  61.         ' Call ShowDialog.
  62.         Dim a = New SaveFileDialog()
  63.         Dim result As DialogResult = a.ShowDialog()
  64.  
  65.         ' Test result.
  66.         While True
  67.             If result = DialogResult.OK Then
  68.                 Try
  69.                     My.Computer.FileSystem.WriteAllText(a.FileName, SaveMyFile, False)
  70.                     Exit While
  71.                 Catch ex As Exception
  72.                     MsgBox("Could not save file due to the " & "following error" & vbCrLf & ex.Message)
  73.                 End Try
  74.             End If
  75.             MsgBox("fu")
  76.         End While
  77.     End Sub
  78.  
  79.     Private Sub LinkLabel1_LinkClicked(sender As Object, e As LinkLabelLinkClickedEventArgs) Handles LinkLabel1.LinkClicked
  80.         LinkLabel1.LinkVisited = True
  81.         System.Diagnostics.Process.Start("https://www.xe.com/currency/gbp-british-pound?r=")
  82.     End Sub
  83. End Class
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top