Click here to Skip to main content
15,907,913 members
Home / Discussions / C#
   

C#

 
AnswerRe: SqlServerCeException "There was an error parsing the query" help .... Pin
Md. Marufuzzaman1-Oct-09 7:07
professionalMd. Marufuzzaman1-Oct-09 7:07 
GeneralRe: SqlServerCeException "There was an error parsing the query" help .... Pin
hande541-Oct-09 7:57
hande541-Oct-09 7:57 
GeneralRe: SqlServerCeException "There was an error parsing the query" help .... Pin
Md. Marufuzzaman1-Oct-09 8:29
professionalMd. Marufuzzaman1-Oct-09 8:29 
GeneralRe: SqlServerCeException "There was an error parsing the query" help .... Pin
hande541-Oct-09 8:50
hande541-Oct-09 8:50 
GeneralRe: SqlServerCeException "There was an error parsing the query" help .... Pin
Abhishek Sur1-Oct-09 10:31
professionalAbhishek Sur1-Oct-09 10:31 
GeneralRe: SqlServerCeException "There was an error parsing the query" help .... Pin
hande541-Oct-09 10:33
hande541-Oct-09 10:33 
GeneralRe: SqlServerCeException "There was an error parsing the query" help .... Pin
Md. Marufuzzaman1-Oct-09 20:15
professionalMd. Marufuzzaman1-Oct-09 20:15 
Questionsocket problem: works in visual studio, not as release Pin
TimWallace1-Oct-09 5:49
TimWallace1-Oct-09 5:49 
AnswerRe: socket problem: works in visual studio, not as release Pin
Luc Pattyn1-Oct-09 6:22
sitebuilderLuc Pattyn1-Oct-09 6:22 
GeneralRe: socket problem: works in visual studio, not as release Pin
TimWallace1-Oct-09 6:56
TimWallace1-Oct-09 6:56 
GeneralRe: socket problem: works in visual studio, not as release Pin
Luc Pattyn1-Oct-09 7:09
sitebuilderLuc Pattyn1-Oct-09 7:09 
General[SOLVED] Re: socket problem: works in visual studio, not as release Pin
TimWallace1-Oct-09 8:34
TimWallace1-Oct-09 8:34 
GeneralRe: [SOLVED] Re: socket problem: works in visual studio, not as release Pin
Luc Pattyn1-Oct-09 8:41
sitebuilderLuc Pattyn1-Oct-09 8:41 
QuestionMethod not calculating properly‏ Pin
Marcus Farrugia1-Oct-09 5:09
Marcus Farrugia1-Oct-09 5:09 
AnswerRe: Method not calculating properly‏ [modified] Pin
harold aptroot1-Oct-09 5:22
harold aptroot1-Oct-09 5:22 
GeneralRe: Method not calculating properly‏ Pin
PIEBALDconsult1-Oct-09 15:31
mvePIEBALDconsult1-Oct-09 15:31 
AnswerRe: Method not calculating properly‏ Pin
Luc Pattyn1-Oct-09 5:34
sitebuilderLuc Pattyn1-Oct-09 5:34 
AnswerRe: Method not calculating properly‏ Pin
J4amieC1-Oct-09 6:32
J4amieC1-Oct-09 6:32 
AnswerRe: Method not calculating properly‏ Pin
Keith Barrow1-Oct-09 7:05
professionalKeith Barrow1-Oct-09 7:05 
QuestionUploading pictures. Pin
Mix Wheels1-Oct-09 4:17
Mix Wheels1-Oct-09 4:17 
AnswerRe: Uploading pictures. Pin
Luc Pattyn1-Oct-09 4:22
sitebuilderLuc Pattyn1-Oct-09 4:22 
QuestionSearching a non-PrimaryKey column within a DataTable with a partial string. Pin
KCI-VA1-Oct-09 3:49
KCI-VA1-Oct-09 3:49 
AnswerRe: Searching a non-PrimaryKey column within a DataTable with a partial string. Pin
Eddy Vluggen1-Oct-09 10:16
professionalEddy Vluggen1-Oct-09 10:16 
QuestionRe: Searching a non-PrimaryKey column within a DataTable with a partial string. Pin
KCI-VA1-Oct-09 10:37
KCI-VA1-Oct-09 10:37 
AnswerRe: Searching a non-PrimaryKey column within a DataTable with a partial string. Pin
KCI-VA8-Oct-09 5:32
KCI-VA8-Oct-09 5:32 
Here is how I eventuall worked this out. I have not tested it deeply so take this only as an outline:

using System.Collections.Generic;

private string strKeyPreview = String.Empty   // Modular level
private List<string> strStudent_List = null;  // Modular level

private void dgv_KeyPress(object sender, KeyPressEventArgs e)
{
   strKeyPreview = e.KeyChar.ToString();
   int intRow = strStudent_List.FindIndex(StartsWithLetter);
   if (intRow >= 0)  // Will be -1 if not found
   {
      // Set cell rather than row.
      dgv[3, intRow].Selected = true;  // Use the index of the displayed name
      dgv.FirstDisplayedScrollingRowIndex = intRow;
   }
}

private bool StartsWithLetter(String s)
{
   if (s.StartsWith(strKeyPreview.ToUpper()) == true)
   {
      return true;
   }
   else
   {
      return false;
   }
}


// The following code should be just after you create the datasource for your dgv.
// Maybe there is better way than brute force ... help me out here.
strStudent_List = new List<string>();
foreach (DataRow dr in dt.Rows)  // Where dt is the DataTable bound to the dgv
{
   strStudent_List.Add(dr[2].ToString());  // Use the index of the displayed name
}


Feel free to post improvement ... I'm sure this is not bullet proof as it is untested.

Live long and prosper.

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.