Visual Basic .NET Forums  

Go Back   Visual Basic .NET Forums > Components & Controls > Grids > Winforms Grids

Winforms Grids Discussion related to grid controls of all types for Winforms

VB.NET Forums Newsletter Signup:
Email address:


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 11-21-2008, 6:03 AM
VB.NET Forum Newbie
.NET Framework: .NET 1.1 (VS 2003)
 
Join Date: Apr 2007
Posts: 21
Reputation: 30
juhah is on a distinguished programming path ahead
Default Datagrid problem

Every time a form is loaded, I create a datagrid with two columns. The problem is that the first cell in the first column is automatically selected and blue. Setting the datagrid ReadOnly-property to False doesn't help. I found that setting the datagrid.Enabled=False helps, but then the scrollbars (which i need) won't work.

How can I make the whole datagrid sort of non-clickable and non-selectable, so that the user can't set focus to the cells, and also the first cell isn't selected when the form is loaded, but the datagrid is still scrollable?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 11-21-2008, 6:49 AM
cjard's Avatar
VB.NET Forum All-Mighty
.NET Framework: .NET 2.0 (VS 2005)
 
Join Date: Apr 2006
Age: 65
Posts: 6,137
Reputation: 658
cjard has a reputation beyond reputecjard has a reputation beyond reputecjard has a reputation beyond reputecjard has a reputation beyond reputecjard has a reputation beyond reputecjard has a reputation beyond reputecjard has a reputation beyond reputecjard has a reputation beyond reputecjard has a reputation beyond reputecjard has a reputation beyond reputecjard has a reputation beyond repute
Default

I dont use DataGRid any more, but you can try the ReadOnly property, and also the properties to set the selection foreground and background colors
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 11-21-2008, 6:59 AM
VB.NET Forum Newbie
.NET Framework: .NET 1.1 (VS 2003)
 
Join Date: Apr 2007
Posts: 21
Reputation: 30
juhah is on a distinguished programming path ahead
Default

I already tried it but the first cell is still selectable and it's still painted as gray and blue
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 11-21-2008, 12:55 PM
VB.NET Forum Idol
.NET Framework: .NET 2.0 (VS 2005)
 
Join Date: Feb 2008
Posts: 712
Reputation: 369
MattP VB.NET gold medalistMattP VB.NET gold medalistMattP VB.NET gold medalistMattP VB.NET gold medalistMattP VB.NET gold medalistMattP VB.NET gold medalistMattP VB.NET gold medalistMattP VB.NET gold medalistMattP VB.NET gold medalistMattP VB.NET gold medalistMattP VB.NET gold medalist
Default

How can I make the datagrid have no currentcell
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 11-22-2008, 4:16 AM
VB.NET Forum Newbie
.NET Framework: .NET 1.1 (VS 2003)
 
Join Date: Apr 2007
Posts: 21
Reputation: 30
juhah is on a distinguished programming path ahead
Default

Thanks for the tip but it doesn't work. Any other solutions?


Quote:
Originally Posted by MattP View Post
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 11-22-2008, 11:56 AM
VB.NET Forum Enthusiast
.NET Framework: .NET 1.1 (VS 2003)
 
Join Date: Oct 2004
Location: Houston, TX, USA
Age: 73
Posts: 32
Reputation: 59
jimmajsterski is on a distinguished programming path ahead
Default

The pointer of the datagrid ALWAYS selects the row it points at.
So you may "unselect" the row as far as removing the highlight color,
but the row remains selected. I don't see any way to truly unselect a row since there is always a pointer present. Maybe DataGrid is not your best choice for your task?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On





All times are GMT -4. The time now is 7:55 PM.

Powered by vBulletin® Version 3.8.3
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.0


For advertising opportunities click here.