title: VB Import variable then use part 1 in dropdown and display part 2 to match selection in part 1
body: <p>I'm using Visual studio to build a small utility.</p>
  
  <p>I'm importing variables from a text file (this makes my program expandable in the future).</p>
  
  <p>I'm running into a road block trying to split the variables into usable parts.</p>
  
  <p>The text file is set up as such:</p>
  
  <pre><code>Game1:flshflhdlsfsdsfs
  Game2:ugdjgndrgbdvdnjd
  Game3:gnnereknengievke
  </code></pre>
  
  <p>And the code I've gathered from searching around trying to understand how I could do this is (It's gone through multiple rewrites but I feel this is probably the closest I've gotten):</p>
  
  <pre><code>    Dim value As String = File.ReadAllText("Games.txt")
      Dim cut_at As String = ":"
      Dim x As Integer = InStr(value, cut_at)
  
      Dim string_before As String = value.Substring(0, x - 2)
      Dim string_after As String = value.Substring(x + cut_at.Length - 1)
  
      Games_drp.Items.AddRange(string_before)
  </code></pre>
  
  <p>When I run a test like this, I get an error that String_before cannot be converted to an object. I tried switching "Dim string_before As String = value.Substring(0, x - 2)" to Dim string_before As Object = value.Substring(0, x - 2), but the dropdown that's supposed to be populated by at least one of the entries before the : has absolutely nothing in it.</p>
  
  <p>Being pretty new at VB and feeling like I've exhausted pretty much every way I could think of searching in google and trying to piece together various bits of information, I figure I'd try asking my own direct question:</p>
  
  <p>How would I go about reading all the lines from a text file, then splitting before the : to fill a combobox, and using a label to display the string after the : matching which ever entry is selected in the dropdown.</p>
  
  <p>Thanks in advance for any help.</p>
  
  <hr>
  
  <p><strong>EDIT with full code:</strong></p>
  
  <pre><code>Imports System.IO
  
  Public Class Saves_frm
      Private Sub Saves_frm_Load(sender As Object, e As EventArgs) Handles MyBase.Load
          Dim value As String = File.ReadAllText("Games.txt")
          Dim cut_at As String = ":"
          Dim x As Integer = InStr(value, cut_at)
  
          Dim string_before As String = value.Substring(0, x - 2)
          Dim string_after As String = value.Substring(x + cut_at.Length - 1)
  
          Games_drp.Items.AddRange(string_before)
  
      End Sub
  End Class
  </code></pre>
  
  <p>When run as is, I get an error that 'string_before' can't be converted from a string to an object, but when I make the following change from:</p>
  
  <p>Dim string_before As String = value.Substring(0, x - 2)</p>
  
  <p>to:</p>
  
  <p>Dim string_before As Object = value.Substring(0, x - 2)</p>
  
  <p>The error goes away, but the dropdown remains blank.</p>