473,405 Members | 2,171 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

No active cell in read-only datagrid

Don
George Shepherd's great Windows Forms FAQ has this article about creating a
datagrid with no active cell:

http://www.syncfusion.com/faq/winforms/search/856.asp

Unfortunately, this only works properly for datagrids that are not ReadOnly
(i.e. a row will become unhighlighted if you click the same cell twice).

Has anyone discovered a way to have a read-only datagrid with no active
cell?

- Don
Nov 21 '05 #1
1 1504
Don
My own solution to this problem was to use George Shepherd's solution, but
use it with an extended datagrid. My new datagrid looks like this:

Public Class DataGridEx

Inherits DataGrid

Protected Overrides Sub OnDataSourceChanged(ByVal e As System.EventArgs)

MyBase.OnDataSourceChanged(e)

' This prevents the 'add new' row from ever appearing! woohoo!
Try

Dim cm As CurrencyManager =
CType(Me.BindingContext(Me.DataSource, _
Me.DataMember), CurrencyManager)

CType(cm.List, DataView).AllowNew = False

Catch ex As Exception

Console.WriteLine("ERROR in DataGridEx.OnDataSourceChanged - " &
_
ex.Message)

End Try

End Sub

End Class
The code I put in the OnDataSourceChanged() method prevents the 'add new'
line from appearing in the datagrid. This way, I can leave the ReadOnly
property of the grid as "False" so that the "de-selection" bug with
Shepherd's solution doesn't occur. It seems to work fine for my purposes.

- Don
Nov 21 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

18
by: Frank M. Walter | last post by:
Hello, I have made an small AddIn with udf for excel 2003. I use vs2003. The point of view is the function __T() I call it in excel sheet writing =__T() I am not able to set a value to a...
1
by: htperth | last post by:
Hi all, Note that I'm new to LDAP and Active Directory and am writing an application that retrieves a simple phone list for all the users in our domain. So far I have the following console app...
1
by: htperth | last post by:
Hi all, Note that I'm new to LDAP and Active Directory and am writing an application that retrieves a simple phone list for all the users in our domain. So far I have the following console app...
1
by: mssbass | last post by:
Is there a way to force cell $A$2 to always equal the active row staying on column C? For example, if the user is on row #142, $A$2 would then = $C142? Thank you
4
by: scolivas | last post by:
I am wanting to let viewers know why a refreshable spreadsheet did not refresh. Often times its an ODBC time out error - I put an error handler into the macro that runs the refresh - so that it will...
0
by: suresh_punniyakkodi | last post by:
Hellow Friends, I have one doubt, please help me... In Excel, i have lot of rows and coloumns, i need to read all cell values with in rows and coloumn limit... At the time...
1
by: mohanprasadgutta | last post by:
Hello everybody, I am facing problem in read color of a cell. problem description is as follows. for a particular cell by default colorindex = 35 is provided. but that cell is conditional...
2
by: laszlokenez | last post by:
Tested in IE7 and FF2. I have 2 frames, 2 similar tables in them, similar CSS. (I have 1px cellpadding, and 1px border aroud the cells. From one frame I read the offsetHeight of a cell...
0
by: lairpr74 | last post by:
Hi, I got a console application that updates active directory users, the information to be updated in active directory comes from a database table. This is my problem: right now the application...
1
rahulephp
by: rahulephp | last post by:
Hi there, Kindly have a look on below CSS property. What i want to ask is: when i'll click on a button, it should be look active. I mean it would have to get property of .sidebar_menu:active But...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.