Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > .NET > .NET 3.5 and Visual Studio. 2008 > Visual Studio 2008
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Visual Studio 2008 For discussing Visual Studio 2008. Please post code questions about a specific language (C#, VB, ASP.NET, etc) in the correct language forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Visual Studio 2008 section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old August 13th, 2009, 07:49 AM
Authorized User
Points: 135, Level: 2
Points: 135, Level: 2 Points: 135, Level: 2 Points: 135, Level: 2
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jul 2007
Location: , , .
Posts: 29
Thanks: 2
Thanked 0 Times in 0 Posts
Default DataGridView default selection.

Hi,
I have a datagrid view whose datasource is a datatable.
When the DGV is first loaded, it selects the first cell of first row by defaut.
This does not change even if I call the ClearSelection method after setting the datasource.
Is this the default behaviour of DataGridView.
If yes then how to handle it.

Regards.
Reply With Quote
  #2 (permalink)  
Old August 13th, 2009, 08:43 AM
Authorized User
Points: 135, Level: 2
Points: 135, Level: 2 Points: 135, Level: 2 Points: 135, Level: 2
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jul 2007
Location: , , .
Posts: 29
Thanks: 2
Thanked 0 Times in 0 Posts
Thumbs up Solved.

Hi,
I just solved the problem by setting the current cell to null.

Code:
foreach (DataGridViewCell cell in dataGridView1.SelectedCells)
            {
                cell.Selected = false;
            }

            dataGridView1.CurrentCell = null;
I have other issue now.
I have some code in the CellBeginEdit, which I don't want to fire if a column header is clicked.
Any specific condition that can be checked for?
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
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 Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
DataGridView Use BrianWren Visual Basic 2005 Basics 1 March 5th, 2007 04:34 PM
DataGridView Sakkaw C# 2005 1 January 9th, 2007 12:06 PM
Need Help with datagridview maximus101 VB Databases Basics 2 September 19th, 2006 10:49 AM
Set Default selection in ListBox nmreid Classic ASP Basics 0 January 20th, 2006 04:49 PM
default selection in a datacombo neha_jn VB How-To 4 August 24th, 2004 11:53 PM



All times are GMT -4. The time now is 06:51 AM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.