 |
| 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
|
|
|
|

June 30th, 2004, 10:51 AM
|
|
Authorized User
|
|
Join Date: Jun 2004
Posts: 39
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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.
|
|

June 30th, 2004, 11:04 AM
|
 |
Friend of Wrox
|
|
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
|
|
What are you compiling with?? I have SelectedIndexChanged.
|
|

June 30th, 2004, 11:06 AM
|
|
Authorized User
|
|
Join Date: Jun 2004
Posts: 39
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Microsoft Visual C# .Net
|
|

June 30th, 2004, 11:13 AM
|
 |
Friend of Wrox
|
|
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
|
|
What's the actual error message you are getting? This is very odd.
|
|

June 30th, 2004, 11:15 AM
|
|
Authorized User
|
|
Join Date: Jun 2004
Posts: 39
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
...\My Documents\Visual Studio Projects\Prufa2\Form1.cs(397): 'System.Windows.Forms.DataGrid' does not contain a definition for 'SelectedIndexChanged'
|
|

June 30th, 2004, 11:41 AM
|
 |
Friend of Wrox
|
|
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
|
|
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.)
|
|

June 30th, 2004, 11:47 AM
|
 |
Friend of Wrox
|
|
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
|
|
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.
|
|

June 30th, 2004, 11:24 PM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 996
Thanks: 2
Thanked 11 Times in 11 Posts
|
|
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.
|
|

July 1st, 2004, 04:31 AM
|
|
Authorized User
|
|
Join Date: Jun 2004
Posts: 39
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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 ?
|
|

July 3rd, 2004, 03:16 AM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 996
Thanks: 2
Thanked 11 Times in 11 Posts
|
|
I dont know?! Did u install Visual Stedio & .NET well?!
Always:),
Hovik Melkomian.
|
|
 |