Click here to Skip to main content
15,905,148 members
Home / Discussions / C#
   

C#

 
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 
Questioncalling and displaying url in the same page. Pin
dabuskol14-Jul-10 1:53
dabuskol14-Jul-10 1:53 
AnswerRe: calling and displaying url in the same page. Pin
Peace ON14-Jul-10 1:59
Peace ON14-Jul-10 1:59 
AnswerRe: calling and displaying url in the same page. Pin
Prosanta Kundu online14-Jul-10 2:22
Prosanta Kundu online14-Jul-10 2:22 
GeneralRe: calling and displaying url in the same page. Pin
dabuskol19-Jul-10 0:37
dabuskol19-Jul-10 0:37 
Questionchange cell color of gird view on click event of CELL Pin
220814-Jul-10 1:14
220814-Jul-10 1:14 
AnswerRe: change cell color of gird view on click event of CELL Pin
Prosanta Kundu online14-Jul-10 1:31
Prosanta Kundu online14-Jul-10 1:31 
QuestionSerialport from a remote server Pin
grmihel214-Jul-10 0:18
grmihel214-Jul-10 0:18 
AnswerRe: Serialport from a remote server PinPopular
Richard MacCutchan14-Jul-10 1:15
mveRichard MacCutchan14-Jul-10 1:15 
GeneralRe: Serialport from a remote server Pin
grmihel214-Jul-10 2:32
grmihel214-Jul-10 2:32 
GeneralRe: Serialport from a remote server Pin
Dave Kreskowiak14-Jul-10 3:56
mveDave Kreskowiak14-Jul-10 3:56 
GeneralRe: Serialport from a remote server Pin
grmihel214-Jul-10 4:14
grmihel214-Jul-10 4:14 
GeneralRe: Serialport from a remote server Pin
Dave Kreskowiak14-Jul-10 6:39
mveDave Kreskowiak14-Jul-10 6:39 
QuestionData Types from Datareader Pin
Unsy13-Jul-10 23:20
Unsy13-Jul-10 23:20 
AnswerRe: Data Types from Datareader Pin
Prosanta Kundu online13-Jul-10 23:37
Prosanta Kundu online13-Jul-10 23:37 
AnswerRe: Data Types from Datareader Pin
Peace ON13-Jul-10 23:47
Peace ON13-Jul-10 23:47 
AnswerRe: Data Types from Datareader Pin
riced14-Jul-10 0:10
riced14-Jul-10 0:10 

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.