title: How can I replace a specific value in an array in vb.net
body: <p>Can anyone give me any pointers. I have a text file that contains dates and values that have been read into an array and displayed in a <code>ListBox</code>. I need to be able to add new dates and values to the array as well as checking for existing dates in the array so that I can prompt the user to overwrite or cancel.</p>
  
  <p>The part I'm struggling with (forgive me I'm new to this) is how to replace the value in the array if the user selects to overwrite. The code below is what I'm using to check for the existence of the date in the array and what I need to be able to do is replace the existing value that goes with date and update the <code>ListBox</code> with the new data.</p>
  
  <p>There are 2 arrays <code>Dates</code> and <code>Values</code> that are displayed in the <code>ListBox</code></p>
  
  <pre><code>If Dates.Contains(Format(DateTimePicker2.Value, "dd/MM/yyyy")) Then
      MsgBox("Do You Wish To Overwrite Record?", MsgBoxStyle.YesNo, "Data already exists")
      If MsgBoxResult.No Then
         Exit Sub
      ElseIf MsgBoxResult.Yes Then
          Don't know what to do here !!!!!
  End If
  </code></pre>