Click here to Skip to main content
15,921,454 members
Home / Discussions / C#
   

C#

 
GeneralRe: How do I format Column when a Gridview loads? Pin
Luc Pattyn14-Jul-10 11:08
sitebuilderLuc Pattyn14-Jul-10 11:08 
QuestionSMF Forum login using webclient [modified] Pin
Skymir14-Jul-10 8:06
Skymir14-Jul-10 8:06 
AnswerRe: SMF Forum login using webclient Pin
Ennis Ray Lynch, Jr.14-Jul-10 9:00
Ennis Ray Lynch, Jr.14-Jul-10 9:00 
QuestionIntellisense Documenation Pin
programmervb.netc++14-Jul-10 4:44
programmervb.netc++14-Jul-10 4:44 
AnswerRe: Intellisense Documenation Pin
Luc Pattyn14-Jul-10 5:06
sitebuilderLuc Pattyn14-Jul-10 5:06 
GeneralRe: Intellisense Documenation Pin
OriginalGriff14-Jul-10 5:18
mveOriginalGriff14-Jul-10 5:18 
GeneralRe: Intellisense Documenation Pin
Luc Pattyn14-Jul-10 5:23
sitebuilderLuc Pattyn14-Jul-10 5:23 
GeneralRe: Intellisense Documenation Pin
OriginalGriff14-Jul-10 6:00
mveOriginalGriff14-Jul-10 6:00 
GeneralRe: Intellisense Documenation Pin
Luc Pattyn14-Jul-10 6:38
sitebuilderLuc Pattyn14-Jul-10 6:38 
GeneralRe: Intellisense Documenation Pin
OriginalGriff14-Jul-10 8:11
mveOriginalGriff14-Jul-10 8:11 
GeneralRe: Intellisense Documenation Pin
Wes Aday14-Jul-10 6:28
professionalWes Aday14-Jul-10 6:28 
GeneralRe: Intellisense Documenation Pin
programmervb.netc++14-Jul-10 5:26
programmervb.netc++14-Jul-10 5:26 
AnswerRe: Intellisense Documenation Pin
Ennis Ray Lynch, Jr.14-Jul-10 5:09
Ennis Ray Lynch, Jr.14-Jul-10 5:09 
QuestionGenerating C file using C# Pin
Niungareamit14-Jul-10 3:03
Niungareamit14-Jul-10 3:03 
AnswerRe: Generating C file using C# Pin
Eddy Vluggen14-Jul-10 3:12
professionalEddy Vluggen14-Jul-10 3:12 
GeneralRe: Generating C file using C# Pin
Niungareamit14-Jul-10 3:50
Niungareamit14-Jul-10 3:50 
GeneralRe: Generating C file using C# Pin
Eddy Vluggen14-Jul-10 4:03
professionalEddy Vluggen14-Jul-10 4:03 
AnswerRe: Generating C file using C# Pin
Peace ON14-Jul-10 3:22
Peace ON14-Jul-10 3:22 
AnswerRe: Generating C file using C# Pin
Richard MacCutchan14-Jul-10 5:58
mveRichard MacCutchan14-Jul-10 5:58 
AnswerRe: Generating C file using C# Pin
T M Gray14-Jul-10 7:23
T M Gray14-Jul-10 7:23 
AnswerRe: Generating C file using C# Pin
CPallini14-Jul-10 8:08
mveCPallini14-Jul-10 8:08 
GeneralRe: Generating C file using C# Pin
DaveyM6914-Jul-10 9:15
professionalDaveyM6914-Jul-10 9:15 
QuestionHow to disable selection in datagridview. Pin
NarVish14-Jul-10 2:59
NarVish14-Jul-10 2:59 
AnswerRe: How to disable selection in datagridview. Pin
Peace ON14-Jul-10 3:19
Peace ON14-Jul-10 3:19 
You have two choices for the same.

1. If you want to allow selection for certain rows and disable selection
for other rows then try following.

If SelectionMode is FullRowSelect, then you'll need to override SetSelectedRowCore for that DataGridView, and not call the base SetSelectedRowCore for rows you don't want selected.

If SelectionMode is not FullRowSelect, you'll want to additionally override SetSelectedCellCore (and not call the base SetSelectedCellCore for rows you don't want selected), as SetSelectedRowCore will only kick in if you click the row header and not an individual cell.


2. Try following.

C#
private  void dataGridView1_SelectionChanged(object sender, EventArgs e)
{
    if (this.dataGridView1.SelectedCells.Count > 0)
    {
        this.dataGridView1.SelectedCells[0].Selected = false;
    }
}



HTH
Jinal Desai - LIVE
Experience is mother of sage....

GeneralRe: How to disable selection in datagridview. Pin
NarVish14-Jul-10 3:26
NarVish14-Jul-10 3:26 

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.