Login Register






Thread Rating:
  • 0 Vote(s) - 0 Average


[VB.Net] [Source] Simple Dictionary/Translator etc. filter_list
Author
Message
[VB.Net] [Source] Simple Dictionary/Translator etc. #1
Using this you can make your own glossary, dictionary, translator, etc.

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
[Image: rytwG00.png]
Redcat Revolution!

Reply

RE: [VB.Net] [Source] Simple Dictionary/Translator etc. #2
Ha, this is a pretty cool idea. I need to learn some VB.net. Until then, Im gonna copy/paste your code and use it. ^_^
Even if on the slightest you take a smidget
Or dare touch my revenue I slice you with the razor, quit it
Icey till I make it frigid... (BURRRR)...
The laws of physics says it's getting cold...
My money taller than a hall of midgets

-Busta Rhymes

Reply







Users browsing this thread: 1 Guest(s)