[VB.Net] [Source] Simple Dictionary/Translator etc. 12-02-2010, 01:20 PM
#1
Using this you can make your own glossary, dictionary, translator, etc.
Usage:
Add a ListBox and a TextBox to a form.
Add 2 text files in your resources: ListF, ListW
Now Write in them line by line, corresponding data.
Now run app and click an item in the Listbox, and it will display the corresponding data in the Textbox.
There is no Exception catching so code your own.
Note: This is using vbCr (Enters), so if you want to add multiline data for a single entity then change it to a different uncommon delimiter.
Happy coding.
Code:
Dim wText As String = My.Resources.ListF, FText As String = My.Resources.ListW
Dim a() As String = wText.Split(vbCr), b() As String = FText.Split(vbCr)
Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
LoadAll()
End Sub
Private Sub ListBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ListBox1.SelectedIndexChanged
If ListBox1.SelectedItem <> "" Then TextBox2.Text = a(ListBox1.SelectedIndex).Trim
End Sub
Private Function LoadAll()
ListBox1.Items.Clear()
Dim j As Long
For j = 0 To b.GetUpperBound(0)
ListBox1.Items.Add(b(j))
Next
Return Nothing
End Function
Usage:
Add a ListBox and a TextBox to a form.
Add 2 text files in your resources: ListF, ListW
Now Write in them line by line, corresponding data.
Quote:ListF
A round, firm, fleshy, edible fruit with a green, yellow, or red skin and small seeds
Any round, or spherical, object; sphere; globe
ListW
Apple
Ball
Now run app and click an item in the Listbox, and it will display the corresponding data in the Textbox.
There is no Exception catching so code your own.
Note: This is using vbCr (Enters), so if you want to add multiline data for a single entity then change it to a different uncommon delimiter.
Happy coding.
![Smile Smile](https://sinister.ly/images/smilies/set/smile.png)
![[Image: rytwG00.png]](http://i.imgur.com/rytwG00.png)
Redcat Revolution!