you need to read the file in memory perhaps, and then search the collection/array for the value the user entered.
here is a VERY BASIC example:
List<KeyValuePair<string, string>> items = new List<KeyValuePair<string, string>>();
..
..
// some function called at startup to read the entire file in the collection
private void LoadData()
{
var reader = new StreamReader(File.OpenRead(@"C:\dictionary.csv"));
while (!reader.EndOfStream)
{
var line = reader.ReadLine();
var values = line.Split(';');
var kvp = new KeyValuePair<string, string>(values[0], values[1]);
items.Add(kvp);
}
}
private string SearchWord(string inputWord)
{
string returnValue = string.Empty;
foreach(var currentItem in items)
{
if (string.Equals(inputWord, currentItem, StringComparison.OrdinalIgnoreCase))
{
returnValue = currentItem.Value;
break;
}
}
return returnValue;
}
What's it doing?
well we hold a global collection of items in a List. Each item in a list contains a key and an associated value. the key is the word to translate FROM and the value is the translated word.
When the app starts up for example, you call LoadData() to load the file into the collection.
when the user presses the button, you call "SearchResult" passing it the input value from the textbox. Then it will iterate through the collection to find the input value and if it finds it, it will return the translated word back to you, so you take that value and set it into another textbox for example.
again, very basic and simple.
I did not go for the Dictionary, but it is better, purely because I don't know your requirements well enough. But if you are sure that there are no duplicate words (keys) then you should use a dictionary instead of a List> like I have done.