Hello! Hope you can help me. I have a code that works, but only when I use a button for ONE spesific searchword. I need to go into the code to change it every time. This is why I need a search box...I thin I hve what i need, but there is a problem that causes the app to crash/freeze.
THE PROBLEM: when I type a single letter it starts searching for that letter. I don't want anything to happen before i have written the whole word and pressed the search button.
Can you tell med what to do and how i can make the functionality to the button? I want to type a word and then press a button to make a search. (as it is now, the program stops only by entering a letter or sign....)
Main window.xaml:
private void SearchTextBox_TextChanged_1(object sender, TextChangedEventArgs e)
{
Docs.GetDatabase((sender as TextBox).Text);
}
Database.cs:
public static MongoDatabase GetDatabase(String searchText)
{
QueryTest = searchText;
System.Console.WriteLine(QueryTest);
MongoServerSettings settings = new MongoServerSettings();
settings.Server = new MongoServerAddress("lysing.uia.no", 27017);
MongoServer server = new MongoServer(settings);
MongoDatabase database = server.GetDatabase("tweet_database");
var collection = database.GetCollection<Tweets>("docs");
System.Console.WriteLine("5");
var query = Query.Matches ("Text", QueryTest); //Should probably be something like Matches("text", "searchFromTextBoxInMainWindow.xaml")
//Another option is trying to make the searchbox update QueryTest.
Thank you!