I would like to add a new row in my datagrid, which is the summary of the other rows in the datagrid. Much like a "Total" row in excel spreadsheet. Thing is, when my user sorts the datagrid by clicking one of the column headers, I would like this Summary row to stay at the bottom. Have done my research but the only thing I came across when it comes to sorting is the AllowSorting() method.
Also, it would be great if I can have my first column also frozen when I scroll to the right, such that the user will be able to see to which row header the value belongs to without having to scroll back to the left everytime.
Thanks in advance!
I've been looking around for a book or a site that does a good job explaining how to create a custom control. I would like that it cover issues like efficiency and usage of current .Net technologies. I haven't been able to find any information out there except for a book that was written while .NET was in beta. Anybody have suggestions?
I found that "Windows Forms Programming in C#" to be an overall excellent book on intermidiate to advanced levels. Written by Chris Sells, published by Addison Wesley.
ISBN # 0-321-11620-8. He covers Custom controls in much detail!
While i was amazing myself discovering the dateset design wizard (which means that me querys methods will get waaaay shorter now ), i'm not able to insert a row in the Access database.
I'm using a query to load a treeview, which works just fine:
privatevoid GenerateTreeview()<br />
onAirDataSetTableAdapters.contenidoTableAdapter contAdap = new Loteria.onAirDataSetTableAdapters.contenidoTableAdapter(); <br />
DataTable tabla = contAdap.ObtenerDatos(); <br />
DataView dataViewHijos = new DataView(tabla);<br />
and so on....<br />
now, i want to add a node on the treeview, and store that into the database table where I have my items. I tried this on a try/catch/finally, just to make sure i'm not getting any errors. I call generateTreeview() function on finally, to reload my Treeview.
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook
The MSDN information is what I would read to get the information, as well as some sample code, though I do have some trouble understaing it sometimes. From my understanding (still learning) the FindIndex takes a predicate. The predicate is basically a function that accepts a value of whatever type your list contains, does a calculation, and returns true or false.
So let's say I have a List of INTs. If I wanted to search for the first occurance of a number greater than 5, I would create a function like this:
Then, when I want to find the first instance in my INT list that is greater than 5, I do this.
int FirstOccurance = myIntList.FindIndex(IsGreaterThan5);<br />
There are also other variations of the FindIndex function that you can use:
List.FindIndex(int32, predicate) - Limits the search range from the int32 element to the end of the list
List.FindIndex(int32, int32, predicate) - Limits the search range from int32 to int32.
I've read the msdn library for both code sample of this method and the documentation about it.
But i didn't understand it very well.
I've also searched with google for another example...
This is what i've tried:
// convertedString is an int
int indexOfNumber = this.listViewItems.FindIndex(FindIndexOfListViewItem(convertedString);
private int FindIndexOfListViewItem(int index)
for (int i = 0; i < this.listViewItems.Count; i++)
string currentItem = this.listViewItems[i].ToString();
//this.number is the item i wanna add as a subItem
if (currentItem == this.number)
These are the errors i get:
The best overloaded method match for 'System.Collections.Generic.List<system.windows.forms.listviewitem>.FindIndex(System.Predicate<system.windows.forms.listviewitem>)' has some invalid arguments
Argument '1': cannot convert from 'int' to 'System.Predicate<system.windows.forms.listviewitem>'
What am i doing wrong?
Thanks in advance!
-- modified at 3:26 Thursday 11th January, 2007
How do I get a form I have added to my project to show? I want it to show in response to a user's button click.
Also, how do I design a form that looks like, for example, the "Exception Assistant" dialog? It doesn't have that heavy blue border/header at the top. Is there some criteria or selection that should be checked or must I code it?
How do I get a form I have added to my project to show?
Create an instance of the class and call ShowDialog()
I want it to show in response to a user's button click.
Then you need a click event. Double click on the button in the designer and you'll get one.
It doesn't have that heavy blue border/header at the top.
Change that property in the form designer. I forget it's name, although I always change it ( the default is resizable form and I never want that ) The default also puts an item in the taskbar, I never want that, either. The default is stupid.
Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog