title: How to populate ListBox from Dictionary Values?
body: <p>Net </p>
  
  <p>I am attempting to create a function that will allow a user to input  text into a RTB and if that text exists in a Dictionary as a Key then a <code>listbox</code> is populated by all the <code>values</code> of the <code>dictionary</code> whose <code>key</code> they are related to , each <code>value</code> populates the <code>listbox</code> in a new line.</p>
  
  <p>the 1st line is highlighted and the user can press the <code>enter button</code> and replace the text in the RTB with the highlighted text .</p>
  
  <p>I'm new to VB so I do not know much .</p>
  
  <p>this is what I have so far.</p>
  
  <pre><code>Public Class Oxnay
  
  Private Sub Oxnay_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
      Tsort()
  End Sub
  Private TDictionary As Dictionary(Of String, String())
  
  Public Sub Tsort()
      TDictionary = New Dictionary(Of String, String())
  
      TDictionary.Add("ape", {"pl", "tz", "xu"})
      TDictionary.Add("lor", {"tv", "px"})
  End Sub
  
  Private Sub RichtextBox1_TextChanged(sender As Object, e As EventArgs) Handles RichTextBox1.TextChanged
      Dim lastword As String = RichTextBox1.Text.Split(" ").Last
  
      If RichTextBox1.ContainsKey(lastword) Then
          'display each string of the dictionary array related to lastword in different lines
          'highlight first line
          'Some[Code]
      Else
          ListBox1.Text = ""
      End If
  End Sub
  </code></pre>
  
  <p>End Class</p>