title: How do you change the value in my.settings in a form when you enter numbers in a textbox in VB.Net
body: <p>I was wondering if you could help me? My question is that, is there a way of changing the value in my.Settings in a form if you enter a number/decimal in a textbox and click a button and then update in the settings to be then changed in another from which is linked to my.Settings in a variable?!</p>
  
  <p>Form 1:</p>
  
  <p>Public Class frmConverter</p>
  
  <pre><code>Dim input As String
  Dim result As Decimal
  
  Dim EUR_Rate As Decimal = My.Settings.EUR_Rates
  Dim USD_Rate As Decimal = 1.6
  Dim JYP_Rate As Decimal = 179.65
  
  Private Sub btnCalc_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCalc.Click
  
      input = txtInput.Text
  
      Try
  
          If ComboBox1.Text = "£" Then
              Pounds()
  
          ElseIf ComboBox1.Text = "€" Then
              Euros()
  
          ElseIf ComboBox1.Text = "$" Then
              Dollars()
  
          ElseIf ComboBox1.Text = "¥" Then
              Yen()
  
          End If
  
      Catch es As Exception
          MsgBox("Error!")
      End Try
  
  End Sub
  
  Private Sub btnSettings_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSettings.Click
  
      Me.Hide()
      frmExchange.Show()
  
  End Sub
  
  Private Sub btnReset_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnReset.Click
  
      txtInput.Text = ""
      lblResult.Text = ""
  
  End Sub
  
  Function Pounds()
  
      If ComboBox1.Text = "£" And ComboBox2.Text = "€" Then
          result = (input * EUR_Rate)
          lblResult.Text = FormatNumber(result, 2) &amp; " " &amp; ComboBox2.Text
  
      ElseIf ComboBox1.Text = "£" And ComboBox2.Text = "$" Then
          result = (input * USD_Rate)
          lblResult.Text = FormatNumber(result, 2) &amp; " " &amp; ComboBox2.Text
  
      ElseIf ComboBox1.Text = "£" And ComboBox2.Text = "¥" Then
          result = (input * JYP_Rate)
          lblResult.Text = FormatNumber(result, 2) &amp; " " &amp; ComboBox2.Text
  
      End If
  
      Return 0
  End Function
  </code></pre>
  
  <p>Form 2:
  Public Class frmExchange</p>
  
  <pre><code>Private Sub frmExchange_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
  
      My.Settings.EUR_Rates = (txtinput.Text)
  
      My.Settings.Save()
      My.Settings.Reload()
  
  End Sub
  
  Public Sub SetNewRate(ByVal rate As Decimal)
  
      txtinput.Text = rate.ToString
  
  End Sub
  
  Private Sub btnchange_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnchange.Click
  
      If ComboBox1.Text = "€" Then
  
          My.Settings.USD_Rates = (txtinput.Text)
          frmConverter.SetNewRate(txtinput.Text)
  
      End If
  
  End Sub
  </code></pre>
  
  <p>End class</p>