Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / C# / June 2007

Tip: Looking for answers? Try searching our database.

Behavior of the DataGrid while closing the application

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
schaf - 20 Jun 2007 12:12 GMT
Hi NG!
I have recognized a strange behavior of the DataGrid control.
If I'm editing the value of a cell in the DataGrid and press the
close
button (of the ControlBox of the application 'X') then the
application
closes but the DataGrid does not loose the Focus. I would like to
save
the changes done in the corresponding cell.

How can I check if I have to save the value in the data grid?

regards
Marcel
Marc Gravell - 20 Jun 2007 12:26 GMT
Can you switch to DataGridView? This appears to be fixed, as
demonstrable by adding the following to my last post:

(add the bottom of the ctor)
       DataGridView dg = new DataGridView();
       dg.Dock = DockStyle.Fill;
       dg.DataSource = new SomeData[] { data };
       Controls.Add(dg);
       dg.BringToFront();

(add to the class)
   protected override void OnClosing(CancelEventArgs e) {
       e.Cancel = MessageBox.Show(this, data.Name + " : " +
data.Size, "Closing", MessageBoxButtons.OKCancel,
MessageBoxIcon.Question, MessageBoxDefaultButton.Button1) ==
DialogResult.Cancel;
   }

With DataGridView you see the new values in the message-box,
suggesting that updates and validation have occurred; with DataGrid
you get (as you posted) the old values.

Marc
schaf - 20 Jun 2007 13:06 GMT
> Can you switch to DataGridView?
No because I'm working on .NEt 1.1
But I have obtained help from the net and the easiest way to solve the
problem is to change the focus of the control in the Closing event.

Thanks
Marc Gravell - 20 Jun 2007 13:30 GMT
yes - same workaround as I am using for tool-strip

Marc

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.