How do i select or set the focus of a particular cell in a datagridview?

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
<!-- [if gte mso 9]><xml> <w:WordDocument> <w:View>Normal</w:View> <w:Zoom>0</w:Zoom> <w:TrackMoves/> <w:TrackFormatting/> <w:PunctuationKerning/> <w:ValidateAgainstSchemas/> <w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid> <w:IgnoreMixedContent>false</w:IgnoreMixedContent>
<w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText> <w:DoNotPromoteQF/> <w:LidThemeOther>EN-US</w:LidThemeOther> <w:LidThemeAsian>X-NONE</w:LidThemeAsian> <w:LidThemeComplexScript>X-NONE</w:LidThemeComplexScript> <w:Compatibility> <w:BreakWrappedTables/>
<w:SnapToGridInCell/> <w:WrapTextWithPunct/> <w:UseAsianBreakRules/> <w:DontGrowAutofit/> <w:SplitPgBreakAndParaMark/> <w:DontVertAlignCellWithSp/> <w:DontBreakConstrainedForcedTables/> <w:DontVertAlignInTxbx/> <w:Word11KerningPairs/> <w:CachedColBalance/>
</w:Compatibility> <w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel> <m:mathPr> <m:mathFont m:val="Cambria Math"/> <m:brkBin m:val="before"/> <m:brkBinSub m:val="--"/> <m:smallFrac m:val="off"/> <m:dispDef/> <m:lMargin m:val="0"/> <m:rMargin m:val="0"/>
<m:defJc m:val="centerGroup"/> <m:wrapIndent m:val="1440"/> <m:intLim m:val="subSup"/> <m:naryLim m:val="undOvr"/> </m:mathPr></w:WordDocument> </xml><![endif]--> <!-- /* Font Definitions */ @font-face {font-family:"Cambria Math"; panose-1:0 0
0 0 0 0 0 0 0 0; mso-font-charset:1; mso-generic-font-family:roman; mso-font-format:other; mso-font-pitch:variable; mso-font-signature:0 0 0 0 0 0;} @font-face {font-family:Calibri; panose-1:2 15 5 2 2 2 4 3 2 4; mso-font-charset:0; mso-generic-font-family:swiss;
mso-font-pitch:variable; mso-font-signature:-1610611985 1073750139 0 0 159 0;} /* Style Definitions */ p.MsoNormal, li.MsoNormal, div.MsoNormal {mso-style-unhide:no; mso-style-qformat:yes; mso-style-parent:""; margin-top:0in; margin-right:0in; margin-bottom:10.0pt;
margin-left:0in; line-height:115%; mso-pagination:widow-orphan; font-size:11.0pt; font-family:"Calibri","sans-serif"; mso-ascii-font-family:Calibri; mso-ascii-theme-font:minor-latin; mso-fareast-font-family:Calibri; mso-fareast-theme-font:minor-latin;
mso-hansi-font-family:Calibri; mso-hansi-theme-font:minor-latin; mso-bidi-font-family:"Times New Roman"; mso-bidi-theme-font:minor-bidi;} .MsoChpDefault {mso-style-type:export-only; mso-default-props:yes; mso-ascii-font-family:Calibri; mso-ascii-theme-font:minor-latin;
mso-fareast-font-family:Calibri; mso-fareast-theme-font:minor-latin; mso-hansi-font-family:Calibri; mso-hansi-theme-font:minor-latin; mso-bidi-font-family:"Times New Roman"; mso-bidi-theme-font:minor-bidi;} .MsoPapDefault {mso-style-type:export-only;
margin-bottom:10.0pt; line-height:115%;} @page Section1 {size:8.5in 11.0in; margin:1.0in 1.0in 1.0in 1.0in; mso-header-margin:.5in; mso-footer-margin:.5in; mso-paper-source:0;} div.Section1 {page:Section1;} -->
Hello,
How do i select or set the focus of a particular cell in a datagridview? Actually, this problem is simple but it is hard for me to solve it coz im only a beginner in c#. So here is my sample list of students as shown below:
<p style="margin-bottom:0.0001pt; line-height:normal <!-- [if gte mso 9]><xml> <u1:WordDocument> <u1:View>Normal</u1:View> <u1:Zoom>0</u1:Zoom> <u1:TrackMoves/> <u1:TrackFormatting/> <u1:PunctuationKerning/> <u1:ValidateAgainstSchemas/> <u1:SaveIfXMLInvalid>false</u1:SaveIfXMLInvalid>
<u1:IgnoreMixedContent>false</u1:IgnoreMixedContent> <u1:AlwaysShowPlaceholderText>false</u1:AlwaysShowPlaceholderText> <u1:DoNotPromoteQF/> <u1:LidThemeOther>EN-US</u1:LidThemeOther> <u1:LidThemeAsian>X-NONE</u1:LidThemeAsian> <u1:LidThemeComplexScript>X-NONE</u1:LidThemeComplexScript>
<u1:Compatibility> <u1:BreakWrappedTables/> <u1:SnapToGridInCell/> <u1:WrapTextWithPunct/> <u1:UseAsianBreakRules/> <u1:DontGrowAutofit/> <u1:SplitPgBreakAndParaMark/> <u1:DontVertAlignCellWithSp/> <u1:DontBreakConstrainedForcedTables/> <u1:DontVertAlignInTxbx/>
<u1:Word11KerningPairs/> <u1:CachedColBalance/> </u1:Compatibility> <u1:BrowserLevel>MicrosoftInternetExplorer4</u1:BrowserLevel> <u2:mathPr> <u2:mathFont u2:val="Cambria Math"/> <u2:brkBin u2:val="before"/> <u2:brkBinSub u2:val="--"/> <u2:smallFrac u2:val="off"/>
<u2:dispDef/> <u2:lMargin u2:val="0"/> <u2:rMargin u2:val="0"/> <u2:defJc u2:val="centerGroup"/> <u2:wrapIndent u2:val="1440"/> <u2:intLim u2:val="subSup"/> <u2:naryLim u2:val="undOvr"/> </u2:mathPr> </u1:WordDocument> </xml><![endif]--><span style="color:black; background:none repeat scroll 0% 0% silver <span style=" Ann

<p style="margin-bottom:0.0001pt; line-height:normal Antoinette
<p style="margin-bottom:0.0001pt; line-height:normal Bernadette
<p style="margin-bottom:0.0001pt; line-height:normal Brenda
<p style="margin-bottom:0.0001pt; line-height:normal Carole
<p style="margin-bottom:0.0001pt; line-height:normal Dean
<p style="margin-bottom:0.0001pt; line-height:normal Millicent
<p style="margin-bottom:0.0001pt; line-height:normal Ralph
<p style="margin-bottom:0.0001pt; line-height:normal Suzie
<p style="margin-bottom:0.0001pt; line-height:normal Victoria
<p style="margin-bottom:0.0001pt; line-height:normal
<p style="margin-bottom:0.0001pt; line-height:normal During runtime the default cursor position will be at the top which is "Ann", So if i key in a letter or name in a textbox for example "s", automatically the cursor @ the datagrid
will set to suzie so the output will be look like this:
<p style="margin-bottom:0.0001pt; line-height:normal
<p style="margin-bottom:0.0001pt; line-height:normal <!-- [if gte mso 9]><xml> <u5:WordDocument> <u5:View>Normal</u5:View> <u5:Zoom>0</u5:Zoom> <u5:TrackMoves/> <u5:TrackFormatting/> <u5:PunctuationKerning/> <u5:ValidateAgainstSchemas/> <u5:SaveIfXMLInvalid>false</u5:SaveIfXMLInvalid>
<u5:IgnoreMixedContent>false</u5:IgnoreMixedContent> <u5:AlwaysShowPlaceholderText>false</u5:AlwaysShowPlaceholderText> <u5:DoNotPromoteQF/> <u5:LidThemeOther>EN-US</u5:LidThemeOther> <u5:LidThemeAsian>X-NONE</u5:LidThemeAsian> <u5:LidThemeComplexScript>X-NONE</u5:LidThemeComplexScript>
<u5:Compatibility> <u5:BreakWrappedTables/> <u5:SnapToGridInCell/> <u5:WrapTextWithPunct/> <u5:UseAsianBreakRules/> <u5:DontGrowAutofit/> <u5:SplitPgBreakAndParaMark/> <u5:DontVertAlignCellWithSp/> <u5:DontBreakConstrainedForcedTables/> <u5:DontVertAlignInTxbx/>
<u5:Word11KerningPairs/> <u5:CachedColBalance/> </u5:Compatibility> <u5:BrowserLevel>MicrosoftInternetExplorer4</u5:BrowserLevel> <u6:mathPr> <u6:mathFont u6:val="Cambria Math"/> <u6:brkBin u6:val="before"/> <u6:brkBinSub u6:val="--"/> <u6:smallFrac u6:val="off"/>
<u6:dispDef/> <u6:lMargin u6:val="0"/> <u6:rMargin u6:val="0"/> <u6:defJc u6:val="centerGroup"/> <u6:wrapIndent u6:val="1440"/> <u6:intLim u6:val="subSup"/> <u6:naryLim u6:val="undOvr"/> </u6:mathPr> </u5:WordDocument> </xml><![endif]--><span style="color:black Ann
<p style="margin-bottom:0.0001pt; line-height:normal Antoinette
<p style="margin-bottom:0.0001pt; line-height:normal Bernadette
<p style="margin-bottom:0.0001pt; line-height:normal Brenda
<p style="margin-bottom:0.0001pt; line-height:normal Carole
<p style="margin-bottom:0.0001pt; line-height:normal Dean
<p style="margin-bottom:0.0001pt; line-height:normal Millicent
<p style="margin-bottom:0.0001pt; line-height:normal Ralph
<p style="margin-bottom:0.0001pt; line-height:normal <span style=" <span style="color:black; background:none repeat scroll 0% 0% gray Suzie

<p style="margin-bottom:0.0001pt; line-height:normal Victoria
<p style="margin-bottom:0.0001pt; line-height:normal
<p style="margin-bottom:0.0001pt; line-height:normal So the position of the cursor was changed and "Suzie" was selected, and if i key in another letter automatically the cursor position will change and so on. I think it is still part of sorting in
sql and it is very useful in windows environment. I need help for this problem.
<p style="margin-bottom:0.0001pt; line-height:normal
<p style="margin-bottom:0.0001pt; line-height:normal Thank you very very much!

Har

View the full article
 
Back
Top