473,396 Members | 1,724 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,396 software developers and data experts.

DataGrid stopping user interaction.

I am currently trying to create a form with a variable number of TextBoxes and a single DataGrid that is used to display historical data. I have programatically set up any number of TextBoxes and a DataGrid with the appropriate number of columns showing.

As the DataGrid is only for showing data I do not want the user to be able to select anywhere on the grid so I added an event handler for the Enter event

Expand|Select|Wrap|Line Numbers
  1. metDatagrid.Enter += new EventHandler(metDatagrid_Enter);
  2. ...
  3.  
  4. void metDatagrid_Enter(object sender, EventArgs e)
  5.         {
  6.             //metDatagrid.SelectNextControl(btnCancel, true, true, false, true);
  7.             btnConfirm.Select();
  8.         }
  9.  
First I tried the "SelectNextControl" command (now commented out) which did not have any effect. Then I tried to force the issue by Selecting an existing button on the form, this seems to work once but any subsequent action allows the user into the DataGrid.

What am I doing wrong ?

Thank you
Jason
May 4 '10 #1
6 1384
Frinavale
9,735 Expert Mod 8TB
I think you might be able to change this behaviour by setting the DataGridView's EditMode to "EditProgrammatically".

When the DataGridView is set to this mode, editing begins only when the BeginEdit method is called.

If you never call the BeginEdit method then one could assume that your DataGridView will never be editable.

Not entirely sure this will work because I haven't tried it but in theory it makes sense to me :)

-Frinny
May 4 '10 #2
@Frinavale
Hi Frinny

I am using a DataGrid not a DataGridView which does not have that method available to me.

Thanks anyway
Jason
May 5 '10 #3
Frinavale
9,735 Expert Mod 8TB
Please take a look at the MSDN documentation for the DataGrid. That article tells you how to do what you want.

In the future please try to research the problem a little more before asking for help. A great place to start researching is the MSDN Library. I recommend bookmarking this link and using the MSDN library as your primary resource whenever you are developing .NET applications.

-Frinny
May 5 '10 #4
I must be missing something. Have read through page twice and not found any solution. Setting read-only to True avoids any updating occurring but the user is still able to select various cells. What I was looking to achieve was a table of historical data but not allow user to do anything but use the scroll bar if necessary.
May 5 '10 #5
Frinavale
9,735 Expert Mod 8TB
Just to clarify...this is a desktop application, right?


-Frinny
May 5 '10 #6
Not quite sure what to answer to that.

It is a windows application using windows forms. The form I am trying to use is in a separate class which is launched as a dialogue box. I am developing in a Citrix environment though.

Hope this is the answer you wanted.

Thanks
Jason
May 5 '10 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Tonya | last post by:
Hi, I need help on datagrid control. I am currently using it to display all the data from a particular table from my DB. What i want is the ability for the user to select a row (the whole row...
5
by: Jack | last post by:
Hi, I have a asp page which is pretty long. This consitst of various recordsets. My intention is to stop execution of a code at a cetain point and test one value prior to this point. Is there any...
1
by: John Katsaridas | last post by:
I have an old software system that is written in COBOL, and I am trying to re-engineer it to a web application on the .NET platform with C#. I want to include a DataGrid in the user interface...
3
by: zlst | last post by:
Many technological innovations rely upon User Interface Design to elevate their technical complexity to a usable product. Technology alone may not win user acceptance and subsequent marketability....
1
by: VM | last post by:
Initially, I had created my Windows application so that my datagrid's source would be updated once the method that filled the table was finished: private void btn_run_Click(object sender,...
1
by: Andrew | last post by:
Hey all, I am very new to ASP.Net (and .Net in general), but that isn't stopping the boss from wanting to begin new projects in it. This latest project has me kinda stumped and after a couple...
13
by: pmcguire | last post by:
I have a DataGrid control for which I have also created several new extended DataGridColumnStyles. They behave pretty nicely, but I can't figure out how to implement Selected Item formatting for...
3
by: Kai Zhang | last post by:
I am trying to display some database records in datagrid using dataset. the records need to be displayed are couple of thousands, but the records in database that the SQL query needs to exam are...
14
by: > Adrian | last post by:
Is there a way of stopping text from highlighting in textbox? Many thanks, Adrian.
1
by: raghudr | last post by:
Hi all, I am displaying a splash screen for which i have created a thread.Since my whole project is launched by windows service and that service will start automatically at the start of the...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
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,...

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.