4 Replies - 6229 Views - Last Post: 21 March 2012 - 03:26 PM Rate Topic: -----

#1 C#Guy  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 19
  • Joined: 21-February 12

Disable datagrid selection

Posted 14 March 2012 - 11:30 PM

Hi
I want to disable datagrid selection without disabling the datagrid.Please help me out.
Regards,
Is This A Good Question/Topic? 0
  • +

Replies To: Disable datagrid selection

#2 eclipsed4utoo  Icon User is offline

  • Not Your Ordinary Programmer
  • member icon

Reputation: 1533
  • View blog
  • Posts: 5,972
  • Joined: 21-March 08

Re: Disable datagrid selection

Posted 15 March 2012 - 06:12 AM

If you are using the DataGridView in WinForms, you can try this.

You would be overriding the SetSelectedRowCore method and not call the Base method.
Was This Post Helpful? 0
  • +
  • -

#3 sela007  Icon User is offline

  • D.I.C Addict

Reputation: 139
  • View blog
  • Posts: 841
  • Joined: 21-December 11

Re: Disable datagrid selection

Posted 15 March 2012 - 09:32 AM

View PostC#Guy, on 14 March 2012 - 11:30 PM, said:

Hi
I want to disable datagrid selection without disabling the datagrid.Please help me out.
Regards,

I don't know is this a best solution for you and if this is what you looking for,,. I have application with datagrid. This datagrid is just for showing data. Just like label, when user click on datagrid nothing happens.but not really...what I've done is, i have change selection back-color and fore-color same as datagrid. Still, user can select row, but it seems like he didn't.
Was This Post Helpful? 0
  • +
  • -

#4 C#Guy  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 19
  • Joined: 21-February 12

Re: Disable datagrid selection

Posted 15 March 2012 - 09:57 PM

View Postsela007, on 15 March 2012 - 09:32 AM, said:

I don't know is this a best solution for you and if this is what you looking for,,. I have application with datagrid. This datagrid is just for showing data. Just like label, when user click on datagrid nothing happens.but not really...what I've done is, i have change selection back-color and fore-color same as datagrid. Still, user can select row, but it seems like he didn't.


Wow!That sounds great sela007.Can you help me with that application.I'm really grateful for your help.
Was This Post Helpful? 0
  • +
  • -

#5 sela007  Icon User is offline

  • D.I.C Addict

Reputation: 139
  • View blog
  • Posts: 841
  • Joined: 21-December 11

Re: Disable datagrid selection

Posted 21 March 2012 - 03:26 PM

Hej C#Guy just go to datagridview properties>default cell style. there you can set selection back-color and fore-color . Sorry for delayed response. If your datagrid backcolor is white set selection back color=white. Same for the fore-color.

This post has been edited by sela007: 21 March 2012 - 03:28 PM

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1