Hello there,
I'm trying to implement a basic barcode scanner into my winforms application with radGridView. I'd like to search the GridView using this barcode scanner, so I have to fill the searchbox programatically. This is successful: I scan a code, it appears in the box. I have to use the Form's KeyPreview property set to TRUE and the Form's KeyPress event (because the scan ends as soon as the scanner send a NewLine character). Here's the code:
private string qrCode=string.Empty;
private void Form1_KeyPress(object sender, KeyPressEventArgs e)
{
qrCode+=e.KeyChar;
if (e.KeyChar == (char) Keys.Return)
{
StartSearch();
}
}
private void StartSearch()
{
GridViewSearchRowInfo searchRow = this.grdMyGridView.MasterView.TableSearchRow;
searchRow.SearchProgressChanged += mySearchResult;
searchRow.Search(qrCode);
qrCode=string.Empty;
}
private void mySearchResult(object sender, SearchProgressChangedEventArgs e)
{
Console.WriteLine("Results: " + e.Cells.Count);
}
My problem is, that I always get 0 results. The searchbox has the search string, this is no problem. If I type this string manually into this box, I get results perfectly. I want my GridView to show the results of scanned strings. Is this possible?
Thanks again for your help!
Attila