i need your help....
i m having certain problems regarding the search funtionality, which you gave me.I want to modify that search engine.
i want that if a user has entered any string ,it should match the complete string with the text property of the form only, not the text which is present on the form and not with the form name.
Also it should check for critical errors like More than one spacing .If there is more than one spacing then also it should automatically remove the extra spaces and display the corresponding form.
Kindly please help me regarding this........
whatever i have done that is in my application .which i have attested here.
Also there is one more thing that on the form which has search option , i cannot make the form open on the panel2 on that same form.
I was able to search forms by their text property.......
I want that the system should first calculate the length of string..If length is less than 20 characters then it should compare only first 15 characters only() removing all white spaces and if length is more than 20 characters it should compare first 30 characters (removing white spaces).
Also, I have made a panel below the search textbox (where we are searching strings), and I want to display the searched form in that panel...
How can I do this...............
You need to elaborate more on your search terms now that I have taken a look at it and thought about it. If the search term is <15 char, the form text is <15, or both? Give me a lots of different scenarios and how the matching should work.
Do you only want to match words [a-Z][0-9] or do you want to match symbols "!@#(@)#$&" too?
With searching you *rarely* get exact matches so you usually want it to be sort of generic.
yes,If the search term is <15 char, the form text is <15.So it should compare at least 12 characters out of 15.If the string is more than 30,then it should compare at least 30 characters.
And my string can contain [a-Z][0-9] and special characters both.
Also there is one more thing that it should match the characters till the end .Even if it gets match after 5 characters but it should compare string till the end otherwise give an error.
For example:I have two forms with text "find the sum of all multiples" and "find the sum of all divisors"...
In these cases if user enters only "find the sum", then it should give an error.Untill and unless user enters completes string it should not show any of the forms.
>> Also, I have made a panel below the search textbox (where we are searching strings), and I want to display the searched form in that panel...
You can't do that on that frmSearch because they enter the keyword search term on that form. On frmResults you can have more than one form match the text so you would have to allow them to choose what panel to be displayed. Unless you wanted an artibrary rule such as "Only show the first form for any search text" but that makes the search meaningless because they could only ever see one result.
I have uploaded a modified version of your project and tested it against these terms:
61: Find the sum of all multiples of 9 lying between 300 and 700.
19: Find the sum of all
20: Find the sum of alX (should match since we compare 15 if length < 20)
25: Find the sum of all multi
33: Find the sum of all multiples ofX (should match since we compare 30 if length > 20)
Is this a school assignment by the way? You having very odd goals for the application :)
Thanks for your reply....
But my problem is not solved yet....
I want only one result for the entered string not more than one . Thats why I want matching of the string till end so that it may display only distinct result.
I want such type of functionality that it matches the text of the form exactly and display only one result, no matter whatever the length of the string is.It should compare the entered string with the text of the form completely ....
this is last time i want you to solve the problem.....
Sorry but, i was not able to explain my problem to you initially.......
Actually, i want the best match n want to display single result's form on panel2. Otherwise it should give error..........
Kindly help me last time..........
Think of what your question started out as:
"I want a way to search all forms for a search string"
(I assumed searching the form's name, caption, and control's text)
and what it has evolved to:
"I want a way to search all forms for a search text and calculate the relevance of the search text to the form's caption. The most relevant form should be displayed in a panel on the search screen."
Calculating search relevance is what google does. Its not that easy. I have answered your original question. Each time I answer a new aspect of your question it evolves. This thread is never going to end.
What about this -- If you show the results form (which can have multiple forms listed on it) and when they highlight a row it will embed the form in a panel. Its almost the same thing but you don't have to make a search ranking function.
I dont want to show multiple forms in result form.When the string is entered in textbox and on clicking on search button, it should match exactly with the text property of the forms and should display that particular form only in the lower panel....
why not just do "if search term == form text" then and do away with the search functioning altogether. That will make it more or less useless though because nobody will ever know the exact text except for you... and you will forget the exact text when you haven't worked on the project for a day making it completley useless.
public static SearchResult FindString2(string Text)
List<SearchResult> result = new List<SearchResult>();
foreach (Type type in Assembly.GetExecutingAssembly().GetTypes())
using (Form f = (Form)Activator.CreateInstance(type))
if (string.Compare(Text, f.Text, true) == 0) //exact match
result.Add(new SearchResult(type, f.Text));
Thanks a lot but the form that exactly matches, its content are not displaying in lower panel .I dont want link to be displayed in separate window(result window) but the matched form should be opened in lower panel below search button...