Wrox Programmer Forums
|
C# Programming questions specific to the Microsoft C# language. See also the forum Beginning Visual C# to discuss that specific Wrox book and code.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C# section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 30th, 2004, 10:51 AM
Authorized User
 
Join Date: Jun 2004
Posts: 39
Thanks: 0
Thanked 0 Times in 0 Posts
Default DataGrid

Okey,

Here is the deal. I successfully inserted a ListBox to my form and got the data from the database to show up and everything was good. I put in the event for SelectedIndexChanged so when I clicked on a line in the ListBox my textBoxes got updated :o)

Now I wanted to use the dataGrid to do the same thing cause it looks nicer but the DataGrid doesn't have the event SelectedIndexChanged??? At least not according to my compiler....

Any ideas ???

Many thanks in advance.

 
Old June 30th, 2004, 11:04 AM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

What are you compiling with?? I have SelectedIndexChanged.
 
Old June 30th, 2004, 11:06 AM
Authorized User
 
Join Date: Jun 2004
Posts: 39
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Microsoft Visual C# .Net

 
Old June 30th, 2004, 11:13 AM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

What's the actual error message you are getting? This is very odd.
 
Old June 30th, 2004, 11:15 AM
Authorized User
 
Join Date: Jun 2004
Posts: 39
Thanks: 0
Thanked 0 Times in 0 Posts
Default

...\My Documents\Visual Studio Projects\Prufa2\Form1.cs(397): 'System.Windows.Forms.DataGrid' does not contain a definition for 'SelectedIndexChanged'
 
Old June 30th, 2004, 11:41 AM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

Ok, my appologies. You didn't specify that you were working in Windows forms, and I assumed Web forms. Most of the questions I answer are for web forms so I often forget about the "other world"! ;)

(Also, it's just a C# form, not specific to a particular project type.)
 
Old June 30th, 2004, 11:47 AM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

And for a more useful response...

How about the "Click" or "CurrentCellChanged" event? I don't see any event that seems targeted at an item as a whole. There are a whole bunch of other events that might be applicable. Check the MSDN docs for the most useful one.
 
Old June 30th, 2004, 11:24 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 996
Thanks: 2
Thanked 11 Times in 11 Posts
Send a message via Yahoo to melvik
Default

Dear ZiqXx:
Right click on ur Grid (or any Control) & See the properties Window. click Even button there to see all event it has. there is a discription of each on in buttom (if u clicked it before) also, so it could help u to know about events of each control.

HTH.

Always:),
Hovik Melkomian.
 
Old July 1st, 2004, 04:31 AM
Authorized User
 
Join Date: Jun 2004
Posts: 39
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi,

Thanks for the replies. I went throught the Events list and found this:
Code:
private void simaskraGrid_CurrentCellChanged(object sender, System.EventArgs e)
{
this.BindingContext[this.Adapter1, "persona"].Position = this.simaskraGrid.CurrentCell.RowNumber;
But then I get this error message:

An unhandled exception of type 'System.ArgumentException' occurred in system.windows.forms.dll

Additional information: Cannot create a child list for field persona.


Any ideas ?

 
Old July 3rd, 2004, 03:16 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 996
Thanks: 2
Thanked 11 Times in 11 Posts
Send a message via Yahoo to melvik
Default

I dont know?! Did u install Visual Stedio & .NET well?!

Always:),
Hovik Melkomian.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Custom paging in Datagrid with datagrid page count madhusrp ASP.NET 1.0 and 1.1 Professional 12 June 2nd, 2008 01:15 PM
User COntrol Datagrid inside datagrid rodmcleay ASP.NET 1.0 and 1.1 Professional 3 April 14th, 2007 10:11 AM
Creating DataGrid In Repeater/DataGrid liduwan ASP.NET 1.0 and 1.1 Professional 9 March 6th, 2007 03:31 PM
datagrid ajaidass ADO.NET 2 March 1st, 2007 05:36 PM
Need help regarding datagrid ngsharmila .NET Framework 1.x 1 February 1st, 2006 12:55 AM





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