14,972,394 members
Everything / General Programming / Sorting

# Sorting

sorting

by
Describes PHP application development with the free Scavix Web Development Framework (Scavix-WDF).
by
A simple, portable yet efficient Quicksort implementation in C
by
Welcome to our Comparison on Sorting Algorithms Article. Here, we'll be comparing the various sorting Algorithms out there on the basic of several factors.
by
Easy way to sort nodes in a TreeView using a recursive function.

## Latest Articles

by
Welcome to our Comparison on Sorting Algorithms Article. Here, we'll be comparing the various sorting Algorithms out there on the basic of several factors.
by
How to implement paging and sorting to yield good performance
by
Linear-time partition: A divide & conquer based selection algorithm
by
An algorithm for sorting integers with a complexity less than O(n log (n))

## All Articles

### Sorting

31 Oct 2014
Describes PHP application development with the free Scavix Web Development Framework (Scavix-WDF).
13 Oct 2013
A simple, portable yet efficient Quicksort implementation in C
15 Mar 2011
Don't use ArrayList. This type is obsolete since generics were introduced in v.2.0. Why do you need all those problems with type casting?Instead, use the generic class System.Collections.Generic.List, http://msdn.microsoft.com/en-us/library/6sh2ey19.aspx[^]. For sorting use some of the...
19 Jul 2021N
Welcome to our Comparison on Sorting Algorithms Article. Here, we'll be comparing the various sorting Algorithms out there on the basic of several factors.
11 Sep 2011
Easy way to sort nodes in a TreeView using a recursive function.
13 Apr 2012
The reason is in the SortedList, the key is added as an integer. So, the order will be 7, 31, 32, 33. Whereas, in the DataTable the value is text, hence, the order is 31e, 32e, 33e, 7i.To get the same sort as in data table, add the key as text i.e.emp.Add(key, type);where key is 31e,...
25 Apr 2012
The Array.Sort(Of TKey, TValue) Method (TKey(), TValue(), IComparer(Of TKey)) explained here http://msdn.microsoft.com/en-us/library/x8kwfbye.aspx[^] can be used for this purpose. In the present case, as the sorting is to be done in Descending order IComparer is required, which is explained here...
8 Aug 2013
Hi ,After doing lot of R&D in Kendo UI i got that if we want sorting ,filtering and paging on client side we have to add .ServerOperation(false) so that all functionality like Sorting and filtering works on client side.
15 Jan 2021
How to implement paging and sorting to yield good performance
16 Mar 2011
Using IComparer, as SAKryukov mentioned, is a good idea, and in your case it should look something like this:using System;using System.Collections.Generic;namespace Harlinn.CP.ScoreTest{ public class Score { private string name; private double...
1 Oct 2015
If only CodeProject had one of the best articles on the subject[^].
1 Oct 2015
You know the major sorting algorithms have been studied and their performance is known (I would reccomend the oldie-goldie Wirth's book[^] as starting point).If you are really curious to measure the performance on your set of data then no one prevents you in doing that.
28 Nov 2015
I see 2 reasons for your program not listing the numbers sorted.First: you list the numbers before sorting them.Second: the sort routine is bugged to the core. The general layout is of an insertion sort, but it is bugged and don't work.Since it is HomeWork, no solution, but advices.-...
23 Feb 2016
The output is correctYour mistake is that you sort a list of strings, not a list of numbers.so "6" fall between "54" and "77"a sort on strings is alphabetical.
2 Sep 2020
Using Bubble sort, it would be something like: def sortTuple(t): for i in range(0, len(t)): for j in range(0, len(t)-i-1): if (t[j][1] > t[j + 1][1]): #notice here, I have used index 1 to use price as the value ...
28 Oct 2020
Linear-time partition: A divide & conquer based selection algorithm
20 Nov 2020
You need to tell sort how to compare the two structs. since there's no default comparison for non basic types. Do you want to sort by name or by grade, or by grade then by name, or ...? Probably the easiest way is to add an operator
7 Dec 2009
I would look at using the KeyPress event on the textbox and set e.Handled=true if the key was a spacebar (e is the KeyPressEventArgs for the event handler). Your code might look something like this:private void TextBox1_KeyPress(object sender, KeyPressEventArgs e){ e.Handled = e.KeyChar ==...
7 Dec 2009
To add onto the answer above, the KeyPress event handler won't work unless you set KeyPreview to true. The KeyPreview property is on the Windows Form (click your form, look to the property box to the right, find KeyPreview, and set it to True). Or you can manually add the following to the...
7 Dec 2009
VB does not use a double equal sign to test for equality. It only uses a single equal sign. Try:e.Handled = (e.KeyChar = " ")Also, it doesn't use semicolons to end lines.
17 Feb 2010
Try this:emails = (from p in DatabaseConnection.Emails where p.Newsmail == true select p).Distinct();
16 Mar 2011
Don't use an ArrayList - use a generic collection. Once you've converted your code, check out this tip/trick:A Generic Comparison Class for Collection Items[^]
26 Mar 2012
A Shunting yard algorithm in C#
17 Apr 2012
If you have a Player class that looks something like this;package my.company;public class Player { private final double x; private final double y; public Player(final double x, final double y) { this.x = x; this.y = y; } public...
16 Sep 2013
The easiest way to do it is to uses Link to objects.myContainer .OrderBy(x => x.FirstColumn) .ThenBy(x => x.SecondColumn);Alternatively, you can define your own comparison operator that will compare first column and if there is a match it will compare next column until the answer is...
16 Sep 2013
I would suggest you to use OLEDB[^] drivers with T-SQL command like this:SELECT Field1, Field2, ... FieldNFROM MyFile.csvORDER BY Field1How to: Use OleDb to import text files (tab, csv, custom)[^]Read Text File (txt, csv, log, tab, fixed length)[^]
19 Sep 2013
Hello Ganesh,For jQGrid if datatype other than "local" the sorting needs to get handled on the server side. For client side sorting the datatype must be "local" and each sortable column must have the sorttype property set (see this[^] link to know more about server side paging and client...
17 Oct 2013
16 Jan 2014
Header Style Combo Box Drop Down Filter Button
23 Mar 2014
After playing with the CheckedListBox a while, I am convinced you will find it much easier to implement this using two ListBoxes. The ListBox offers you built-in sorting by setting its 'Sorted Property to 'true.If you still really wish to use a CheckedListBox, hopefully this code will give...
25 Mar 2014
As Richard MacCutchan said, you will need to design a Database first to capture the information about each meal each user has had.Here's a link to a beginners guide to databases[^]Think carefully about the tables you will need and what sort of information you will need to...
24 May 2014
I wouldn't choose the different path inside the sort function. I would use instead different comparators. For instance, have a look at the following code:#include #include #include using namespace std;struct my_struct{ my_struct(int i, string...
8 Oct 2014
Take a look at these CodeProject articles:Natural Sort Comparer[^]Sorting Strings for Humans with IComparer[^]
18 Feb 2015
Here's an example of a class that uses two Dictionaries.I do caution you about your first criterion as I'm sure my solution will have trouble if a value's priority is changed. DumbStuff.PriorityDictionary d = new...
17 Jul 2015
Your timezone data doesn't contain the offset value, so you'll need to extract it from the label.Something like this should work:timeZone.sort( function( a, b ) { var re = /^\(GMT([+-]\d{1,2}):(\d{1,2})\).*\$/; var aOffset = parseFloat(a.label.replace(re, "\$1.\$2")); var...
22 Nov 2015
Obviously, your own code is like a blackbox to you. It don't do what you expect.What follow is not directly a solution to your problem, but a key that will help you to understand by yourself what is wrong.The debugger is your friend. It will show you what your code is really doing.Follow...
27 Nov 2015
"didn't sort by real number !"OK - but we have no idea what data you were looking at, or how you decided that it didn't work.Plus, it's your homework, so it's a good idea that you sort this yourself - you will learn a lot more than if I fix it and give you the sorted code.So, its going...
23 Feb 2016
This will convert the string to a number when doing the comparison;if (int.Parse(a.ElementAt(j)).CompareTo(int.Parse(a.ElementAt(j + 1))) > 0)However it will error if you add somenone non-numeric to the list. For a number sort you're best using LinkedList x = new...
27 Apr 2016
We do not do your homework: it is set for a reason. It is there so that you think about what you have been told, and try to understand it. It is also there so that your tutor can identify areas where you are weak, and focus more attention on remedial action.Try it yourself, you may find it...
27 Apr 2016
Don't search for code. Study algorithms instead. An oldie-goldie book is Wirth's one: "Algorithms + Data Structures = Programs - Wikipedia, the free encyclopedia"[^]. It could be a staring point, covering all but string matching.
4 Jun 2016
Um...that's some odd code you have there!Start with your first method:int my_array(int _array[],int size ) { for(int i=0;i { return _array[i]; } }It always returns the first element in the array, unless the size is negative, in which case...
20 Jun 2016
To achieve your own sort order you must overwrite the sorting algorithm, by overwriting the comparison operator "
3 May 2017
An algorithm for sorting integers with a complexity less than O(n log (n))
14 Aug 2017
You appear to have at least 6 tables with exactly the same schema. This is usually a sure sign that your database design needs some attention. From what I can see all of this information could be (and should be) stored in a single table. Add another column that indications the "BuildingType" -...
4 Apr 2019
Take your string, and use Split, then sort the array: string query = @"id = 657ec95c439eb4a76e48c5ea7 & amount = 1 & notify_status = success & currency = USD & time = 20190403095815 & reference = 190403175800PTM03428 & notify_id = D0000036639 - a6d98e5d0a08d3e8850f & fields = id %...
29 Jan 2020
The concept you need to do your task is called External sorting[^].
29 Jan 2020
The first thing to do is to start by looking at what you have to sort: what does the file contain that needs sorting? What does it need sorting by? Think about it: if you have a stack of mixed banknotes on your desk, there are many ways to sort them: by denomination, by colour, by size, by...
15 Sep 2020
Try ''' Program to implement Selection Sort The time complexity of above algorithm is O(n^2) ''' def find_min (list0): min = 0 for i in range(1,len(list0)): if list0[i]
13 Apr 2021
The following program (Python 3) s = input() lnum = list(map(int, s.split())) print("Unsorted:", lnum) print("Sorted Ascending Order:") print (sorted(lnum)) print("Sorted Descending Order:") print(sorted(lnum, reverse=True)) executes this...
17 Feb 2010
See here[^].
23 Apr 2010
Hi all,I've landed in a situation where i need the top N number of items in an array, work on those items and reinsert (or update) them back at the exact same indices. I realized that the easiest way would be to sort an array 1st then pick N number of the highest elements, but I find my...
22 Apr 2010
With the pitiful amount of info you've provided, the best I can suggest is that you look into using a Dictionary object instead of an Array.
1 Jun 2010
For this you need to pass Dropdownlist value to XSL using parameter and based on param value which you have received in XSL apply xsl:sort statement. Roughly you need to do following C# CODEXslCompiledTransform tras = new XslCompiledTransform();XsltArgumentList argList = new...
8 May 2011
Ok, found a solution that looks more or less ok to me. I used another class, point_sorter to hold the third point and defined a Comparison Delegate compatible function there to compare the two points.using System;using System.Collections.Generic;using System.Linq;using...
8 May 2011
It's a bit simpler than that!This example sorts a list of Points by looking only at the X distance: List p = new List(); ... // Fill p with Points! p.Sort(new PointComparer()); ... public class...
15 Jul 2011
If all of your data will fit in available memory, you could retrieve all of the data you need to display, and then extract only the items that will fit in a page. Psuedo code:0) retrieve data 1) Calculate number of pages you have - Math.Min(1, Math.Floor(records_retrieved /...
22 Sep 2011
The bug is very apparent: this is the lineCurr.Next := Sorter(Curr.Next);It works only of Curr assigned to Head is NULL. In all other cases, nothing happens to pointers before Sorter calls you with the same very parameter always equal to initial Head. Not going into further detail,...
28 Sep 2011
At a glance, I'd say you should change void add(HeapNode * child) { // if the new value is bigger than this value if(child->value > value)to void add(HeapNode * child) { // if the new value is smaller than this value if(child->value
17 Mar 2012
An alternative is to create one field in the database for color code, say ColorCode, assign the values say 1 - Green, 2 - Yellow, 3 - Red. Then based on this field, apply color to the rows of the DataGridView in CellFormatting event.private void dataGridView1_CellFormatting(object...
19 Mar 2012
You cannot sort the hidden column visually by clicking on the DataGridView as the column is not visible. One of the following options can be used, to sort the hidden column, using the bindingSource1 to which the DataGridView is bound.Option1.Use buttons, say Button1 and Button2 to sort...
2 Apr 2012
To customize sort in a datagridview, go through this article - How to: Customize Sorting in the Windows Forms DataGridView Control[^].
17 Apr 2012
Use a distance function D=sqrt((x1-x2)^2+(y1-y2)^2) and keep the closets ones on the array of K elements.Depending on what your final problem is you could either compare with all and sort, then grab first K, or do it in one pass while putting new ones in a sorted list. up to you.hope it helps.
25 Apr 2012
Dear All,I have two arrays (array1 and array2)with double type data. I want to sort array1 to ascending order, and array2 with corresponding to the array1 indexes. Is this possible? Example below,Array1(0) = 2.30 Array1(1) = 4.20Array1(2) = 1.90Array1(3) = 0.20Array1(4) = 0.88...
2 Oct 2012
How to sort a data bound combobox
18 May 2012
Hey everyone! i stuck here with a thing. I use this code in visual c++ to search a book by its author. I have used the approach of bubble sorting then binary searching.Alright, now this is what i have. what i want to do now is to search a particular BOOK by its author without using the...
24 Jul 2012
Hi,Use this://Dropdownlist selected value changed event. This can be done on button click event also.protected void DropDownList1_SelectIndexChanged(object sender, EventArgs e) { gvSorting.Sort(DropDownList1.SelectedValue, SortDirection.Ascending); ...
10 Sep 2012
Hi,ofcours...
5 Dec 2012
Hi...I have a WPF Datagrid which I've grouped by a column ProductName. I want to perform sorting on UploadDate which is a datefield. The issue here is on clicking on sort I want the data to be sorted on UploadDate within the groups, by the datagrid sorts the data based on the ProductName, on...
16 Dec 2012
How to choose an STL sorting algorithm.
18 Dec 2012
Hello Everyone,I want to sort few records which actually contains Duration but they are in nvarchar datatype.. For eg. Select '33:14:14' as 'Duration'UNIONSelect '1:16:36' as 'Duration'UNIONSelect '0:3' as 'Duration'UNIONSelect '0:29' as 'Duration'UNIONSelect '02:12:39'...
18 Dec 2012
Hi,One solution is converting your data to seconds either on the fly or by using a user defined function.Here is a SQL statement that converts your data to seconds on the fly :SELECT * FROM (SELECT Duration ,CASEWHEN CHARINDEX(':',Duration )=0 THEN CAST (Duration AS...
24 Mar 2013
Following will help you: MSDN: GridView Examples for ASP.NET 2.0: Paging and Sorting the GridView's Data[^]Similar question with answers: Sorting in Gridview Asp.net C#[^]
19 Jun 2013
How large?If it's a couple of megabytes, then try just using Split and Sort: Stopwatch sw = new Stopwatch(); sw.Start(); string s = File.ReadAllText(@"D:\Temp\MyText.txt"); string[] data = s.Split(' ', '\n'); Array.Sort(data); ...
1 Oct 2013
You can have a look at:How do I sort an observable collection?[^]Sorting values of ObservableCollection (Reactive Extensions)[^]
3 Mar 2014
Yes, you can sort the values in an Enum for display in a ComboBox alpha-numerically, or any other way you want:// requires Linq// preserve the current ComboBox selectionprivate V currentVName;private void Form1_Load(object sender, EventArgs e){ var vAry =...
4 Mar 2014
Have a look here: Filtering and Sorting Directly in Data Tables[^]
17 Mar 2014
You may use a dictionary to map the Type Ids to your own order criterion, e.g.Dictionary mo = new Dictionary{ { 3, 0 }, { 5, 1 }, {2,2}, {4,3}, {6,4} };Thendocuments.OrderBy(d => mo[d.Type.Id])
11 Apr 2014
I have a bindinglist of keyvaluepairs that is filled dynamicaly. BindingList> Homelist = new BindingList>(); foreach (ListItem item in listBox2.Items) { Homelist.Add(new KeyValuePair(item.Id, item.Name)); ...
11 Apr 2014
For sorting the list on value rather than key just provide an appropriate compare method ... have a look at this example http://www.dotnetperls.com/sort-keyvaluepair[^]If you want to treat the first 5 items differently to the rest then you could split the list into two separate ones before...
11 Apr 2014
public int Compare(KeyValuePair a, KeyValuePair b) { return a.Value.CompareTo(b.Value); } List> Playinglist = new List>(); for (int i = 0; i
20 Apr 2014
Once you have fixed the code (as it stands it doesn't even compile), no one prevents you using the std::sort[^] function.
29 May 2014
try this.. :) DataSet ds=new DataSet(); DataTable dtTable = new DataTable(); dtTable = ds.Tables[0]; DataView dv = dtTable.DefaultView; dv.Sort = "ColumnName" + " " + "ASC"; //OR dv.Sort =...
8 Oct 2014
var strTest = new List { "B1", "B2","b3","0", "B3", "B10","B20","B90","GB2","B9","B21","GB1","GB11" };I need to sort the above list as "0, b3,B1, B2, B3, B9, B10, B20, B21, B90, GB1, GB2,GB11"Can anyone help me with this one.Thanks in Advance,
29 Oct 2014
Hi.. Make little bit change in your code line ..change it to lstRecData = lstRecData.OrderBy(x => x.strRecPriority).ToList();Here is the sample codeclass Program { static void Main(string[] args) { List lstRecData = new...
29 Oct 2014
HiJust avoid Reverse().it will be fine.List lstRecData = lstRecData.OrderBy(x => x.strRecPriority).ToList();
21 Nov 2014
Quote:unsortDon't alter the array -- make another array with the indices of the first array and alter that -- it's kind of a linked list that way.int[] i = new int[] { 20,5,90,7,44,81 };int[] j = new int[] { 1 , 3 , 0 , 2 , 4 , 5 };
18 Feb 2015
I need a collection of objects that will: * allow get, set functionality object via a key (like in a dictionary)* I need to iterate through the collection in a sorted manner, ordered by a "Priority" value* the priority allows multiple values. * the keys can be an int or a string, it...
3 Mar 2015
Um.You do realise that that code does a total of nothing?for (int i = 0; i
7 Apr 2015
So far, I came up with only some trivial solution: use one more intermediate int object. This is not prohibited by the problems formulation. You can use it to represent a kind of "array of digits". You have only 10 digit, so a digit object needs only 4 bits (half-byte) to represent. But maximum,...
11 Apr 2015
This will do it. It will handle multiple occurrences of digits but not 0 of course (at present 0 is ignored). If required 0 would have to be placed after 9. Easy enough to do. #include int main () { const __int64 input = 456120; __int64 output = 0, temp1; int len =...
4 May 2015
Something like this...dt.DefaultView.Sort = "YourColumnName ASC"; // DESC for descending.
26 Jul 2015
Hello. You should notice, that in your code - you will get only one contour.For your purpose you should fistly get all contours, and after that order them. Check this code:var allContours = new List>(); for (var contours = image.FindContours(); contours !=...
1 Oct 2015
Looks like home work to me.Why not add time measure to your code, implement different algorithms and measure the outcome for the different cases.That should give you the answer which method is most efficient for each case (or maybe for all).
27 Nov 2015
cur->prev = p; if(cur->prev != NULL) it is strongly recommended to use human readable names - so you can see 'cur' is 'p' now. if(p->prev != NULL) p->prev->next = p;regards.
27 Nov 2015
28 Nov 2015
Never ever reinvent sorting yourself. If this is a homework assignment, do it according to your text book. If it is otherwise needed, use any existing sorting, i.e. by using some of the existing Sort functions, e.g.Array.Sort(complexArray,(a,b)=>a.real.CompareTo(b.real));RegardsAndi
19 Jul 2016
I'm given this line of code in particular: public void Test8(List items, int places)The tasks for this problem is to come up with solution where I am able to rotate the List to the right by the specified number of places. A List rotation can be seen as circular, which means...
9 May 2017
Your problem is rather obvious: the sort is perfect! You see date, the computer sees characters. You need to sort them either in your SQL query before you convert the datetime field to a string (unless you horribly store dates as strings!) or maybe try a more useful date format: YYYYMMDD...
20 Jul 2017
The easiest would be to create a sort helper column: assuming Name is col C, Stat is col D and Value is col E the formula in row 5 would be: =TEXT(IF(C5=C4,E4,E5),"000000")&C5 The sort would then be on the column this formula is in (Descending) and the second key column would be the Stat...
9 Sep 2017
You need to be very careful in writing the for statement. If you use the
6 Dec 2017
There is no how, just walk through the code execution flow like a computer, and of course you need to know the language of that code. Do you?
6 Dec 2017
Think about what each line of code does and then describe that in writing. You don't have to describe every single line of code though. For example, in this algorithm the code in the inner loop could be described like this : swap values increment counter That's all - that is the pseudo code for...
5 Apr 2018
int* mergeSort(int* arr){ int size= sizeof(arr)/sizeof(arr[0]); The variable arr is declared as int* type, so its size is 4, and arr[0] is int type, so its size is also 4. So size will always equal 1.
5 Apr 2018
Quote: it compiles but the Windows stops working That is not a good problem description. Windows is an operating system and it will usually not "stop working" when running a program that behaves unpredictable. Do you mean your application (main window) is not responding anymore? Then use a...
23 Apr 2018
Issues are underlined: Dim ascQuery = From asc In ascNames Order by ascName.Lendth Ascending, ascName Descending ... wouls rather be Dim ascQuery = From asc In ascNames Order By asc.Length Ascending, asc Descending Select asc - Variable name is asc, its type is...
24 Apr 2018
In addition to soultion #1 by phil.o[^], a lambda version of solution: Dim ascQry1 = ascNames.OrderBy(Function(x) x.Length).ThenByDescending(Function(x) x) For further details, please see: Enumerable.OrderBy(TSource, TKey) Method (IEnumerable(TSource), Func(TSource, TKey)) (System.Linq)[^]...
12 Jun 2018
Something like this should work, and will correctly rank ties: Dim cumulativeRank As Integer = 1 For Each group As IGrouping(Of Object, DataGridViewRow) In DataGridView1.Rows.Cast(Of DataGridViewRow)().GroupBy(Function (r) r.Cells(0).Value).OrderByDescending(Function (g) g.Key) Dim rank As...
13 Jun 2018
In addition to Richard Deeming[^]'s solution and my comment to His solution... I'd suggest to use Dictionary[^] object when there are rows with duplicate values in ColA Dim dgv As DataGridView = Me.DataGridView1 Dim oDict As Dictionary(Of Integer, Integer) = dgv.Rows().Cast(Of...
3 Sep 2018
You can't just used a "standard string sort" and expect it to give you results that aren't in standard string order - and string ordering is based on comparing each character in turn from the left to the right and the whole comparison being based on the first different character. You need to...
12 Sep 2018
First, fix those syntax errors in your code, then try this: newlist = sorted(oldlist, key=lambda x: x.cost) Sorting HOW TO — Python 3.7.0 documentation[^]
27 Oct 2018
If I were you, I would do make a little set of functions to deal with your data structure. It will clean up the code A LOT! I think you will be able to see logic errors much easier. Here are some examples :int ReadRecord( details * pd, FILE * pf ) { char a[512] = { 0 }; int i = 0; ...
29 Jan 2020
You can find examples in different languages here: external-sorting · GitHub Topics · GitHub[^]
29 Jan 2020
Quote: I'm new to computer science and I can't understand the concept of sorting 100 GB in 1 GB and I would like your help with solving this specific problem. Probably because there is no such concept. HDD storage and memory are essentially the same thing, the difference is that memory space is...
6 Dec 2009
Hi guyz,I wrote a tiny programme in VB.NET using VS.NET 2008 to sort numbers.I take the input of numbers separated by commas from TextBox1.text, play some algorithm then by clicking a button, display the sorted values in TextBox2.text.NOW i want to restrict the numbers to be only 20...
6 Dec 2009
No need to count the commas.Use Textbox1.Text.Split(',').Length. It gives you the count of the numbers added in the textbox separated by comma.
7 Dec 2009
You could do it the reqular expression way:Dim valid AS Boolean = Regex.IsMatch(TextBox1.Text, "^(,?\d+){0,20}\$")This would also validate the input, anything other than numbers or commas would return false.
7 Dec 2009
Hi guys, am back.First i need to thank you for the "regula expression" given to me ealier, it happily solved my problem.:thumbsup:NOW, before sorting an array I get values from TextBox1.Text like(eg. 323,1,65,7,3,999,0,).HOW can i disable the use of spaces in this control to restrict...
7 Dec 2009
Hi giys,i wrote my programme in VS.NET 2008 that takes real numbers separated by commas from TextBox1.Text, sort them and display the sorted in TextBox2.Text.Now i want to add another 2 sorting algorithm that uses the same TexBoxes with different buttons to perform the sorting.I need...
7 Dec 2009
This seems like a homework question...What do you need help with specifically? Sorting algorithms are well documented online. Have you searched online yet? Wikipedia has some good information. Once you've done that, then come here with specific questions and we'll be happy to assist (so long...
9 Dec 2009
Thanks for the help,I worked around modifying regular expression (given to me here here) for different textbox, but i could't get what I neeed. I google it, many things found but not for what i want.Dim valid AS Boolean = Regex.IsMatch(TextBox1.Text,...
9 Dec 2009
Sounds like you want us to make your regular expression for you. What particular trouble are you having creating your regular expression?
11 Feb 2010
What a bizarre post. Blocked where ? By your work ? Are you a programmer ? If there was such a thing as code you could run on the local level that circumvented a block that exists on your firewall, would you know what to do with it ?
17 Feb 2010
IEnumerable emails;try{ emails = (from p in DatabaseConnection.Emails where p.Newsmail == true select p);}catch (Exception x){ throw x;}Any suggestions how to sort the Enum list, to have ONLY one of each email adress in the list? The database table can have 2 instances of...
29 May 2010
Well if you must do many searches, I guess you can consider iterating through the array, finding the best match for each pixel, and storing it.This will sure take some time ( O(n2) ), but once it's done all queries will take no time at all. :)
29 May 2010
Excellent question. I believe I have an answer for you.Sort the pixels into 3 lists. Each list would be sorted by the color intensity of a color component (red, green, or blue). Now, make a grid and set each point to store information about where in the 3 arrays that pixel is located. The...
29 May 2010
Just to add to my previous answer, I thought of another optimization. In each of the 3 lists, you could store sublists. Say you have 10 pixels that have a red value of 0. Then redList[0] would contain a list of those pixels sorted accorded to their green values. So, redList[0][1] would store a...
30 May 2010
One more thing to optimize my previous suggestion. If you travel 1 color value at a time in all 3 lists at once, then you can keep track of how far you've travelled in the other lists to know what the best possible minimum color you could achieve is. That way, you can use that as an exit...
31 May 2010
I have loaded a xml into my project and used xmltransform class to apply the Xslt so that it would sort the document by a particular column (while also using Xpath). I need to be able to change the sorting on the page to different columns by changing a Dropdownlist.I have tried various...
28 Jun 2010
I have employed List.Sort after reading that it's algorithm is not only much easier to use but also faster than my own sorting techniques.The benchmarks prove this true, but there is one thing that is stopping me from committing to using this method:When the comparison is equal, the sort...
28 Jun 2010
I believe it's because of the QuickSort implementation that's internally used. This is a bit of a hack, but you could do this:friends.Sort(delegate(Friend f1, Friend f2) { return f2.Rating.CompareTo(f1.Rating) >= 0 ? 1 : -1; });
28 Jun 2010
So to anyone who cares, this is what I ended up with:friends.Sort(delegate(Friend f1, Friend f2) { int i = f2.Rating.CompareTo(f1.Rating); return i == 0 ? f1.FriendName.CompareTo(f2.FriendName) : i; });
30 Aug 2010
Hi All,I have used to select method to get the data from datatable.For example, DataTable dt = new DataTable(); dt.Columns.Add(new DataColumn("Group", typeof(int))); dt.Columns.Add(new DataColumn("name", typeof(string))); DataRow dr = dt.NewRow(); ...
30 Aug 2010
You use an order by clause to specific the order of your data. It seems to be ordering by group by default, so you need to be able to specify the order by some value.
30 Aug 2010
Hi All,I tried to use dataview rowfilter instead of datatable.select when it is working fine. Here this,DataView dv = dt.DefaultView;dv.RowFilter = "group in (1,2)";dt = dv.ToTable();I got solution.Thanks
31 Aug 2010
I'm absolutely out of any ideas ...I want to sort a tree by the TreeNode_SortOrder field.Here is what I have so far:I have created an Ado .Net entity model looking like this:Sample ImageIn fact, this is more or less a common adjacent list. I can represent a whole tree with this...
6 Sep 2010
This should be no problem with a value converter.Simple example (new WPF project, DataContext of MainWindow set to Application.Current): public class Node { public Node(int ordinal) { this.Ordinal = ordinal; this.Children = new...
9 Nov 2010
Hi,We have created a SSRS report over the analysis services database.This report is added to a web part in sharepoint 2010. When we sets the toolbar to be visible, sorting works fine but when it is made invisible, the request is not going to the report server and it shows report server...
14 Feb 2011
Sorting Lists Using an Anonymous Delegate
17 Feb 2011
You need to handle the SortCommand event: MSDN[^] explains how - look under "Specifying Custom Sorting" for details
17 Feb 2011
Hi Raghavendra HG,Be sure your entry to the datagridview is numeric not string dataIf not you must casting it before ordering.I hope this helps you,:)
17 Feb 2011
Hi! You have to first set property AllowSorting="True" and then generate event OnSorting="gridview_Sorting". And then apply sorting on Datasource and Bind the data as per your sort order and column.And for sorting dataview u can use Lambda ExpressionDataView sorted =...
17 Feb 2011
Hi thank you for all your replies. I tried the below one.dt.Columns.Add("SOWId", typeof(int));You need to specify the type of the item template values before binding the data into data table by using 'typeof' keyword.This solved the problem... :)
16 Feb 2011
Hi,There are many ways to achieve this.1) The best way would be using a clustering algorithm with a maximum likelihood function. On the result of it each pixel will have a cluster membership. So in your subsequent search's you only need to search within the cluster members, not all the...
26 Mar 2011
How generics can be used to sort lists easily and efficiently.
14 Apr 2011
Hi,I have a code that filters the content of the datagrid based on the name(column)private void Filter_Click(object sender, System.Windows.RoutedEventArgs e){ ilterDescriptor filter = new FilterDescriptor("Name", FilterOperator.Contains, (RadGridView1.SelectedItem as...
14 Apr 2011
You can use GridView sort, http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.gridview.sort.aspx[^]
14 Apr 2011
You might want to visit the RadGrid forums. This code looks fine to me.
30 Apr 2011
8 May 2011
see if this alternate can help.. class Program { public class User { public string Name; public int Age; public User(string name, int age) { this.Name = name; this.Age = age; }...
8 May 2011
An alternative if "point" is your custom type.public class point: IComparable{ // do your stuff public int CompareTo(point obj) { // Replace X with your distance stuff (however you compute it). return this.X.CompareTo(obj.X); }}This way you can call...
6 Jun 2011
I made some progress but still there're some problems after sort by clicking on header grid collumn. I tried to reset the bindingSource1.Sort = ""; in the move rows function, and the row and now the row get moved but the position is wrong!! Here the code so you try by yourself.. public...
21 Jun 2011
Hello , In my datagrid my textColumn looks like:Collapse IsReadOnly="True" Width="300" Binding="{Binding Path=CT_APPR.NAME}" SortMemberPath="{Binding Path=CT_APPR.NAME}" >My datagrid looks fine, so the binding is correct.But when I click on the...
21 Jun 2011
15 Jul 2011
Hi Guys,I spent couple of hours in google looking for idea on how to implement paging/sorting in gridview in an optimize manner.Database side:make a query that will only get the number of records for display. (i am clear with this)(Server Code):Use ObjectContainerDatasource and...
1 Oct 2011
How to count positive values WHILE doing HeapSort? Here is my HeapSort and I count them in a loop at the end of the method, but it needs to be done while sorting. How's that?void Sift(int arr[], int left, int right){ int i, j, x; i = left; j = 2 * i + 1; x =...
10 Oct 2011
Hi commmmmmunity :)I have a WPF DataGrid. There are Two Columns. Column A is visible, Column B isnt.I've implement some code that does the following:By clicking into the header Of Column A, the datagrid get sorted by Column B.But, as said, Column B isnt visible. maybe the User...
3 Nov 2011
Why?It's not going to be faster. The sort is O(n log n). So the fastest you could hope to be while doing it during the sort is O(n log n) comparsions (and you can't do it in one comparison).The loop at the end is O(n). And if you want to speed that up, do it as:int i =...
4 Nov 2011
There is no reason to loop over all of the values which requires a O(n) operation for an algorithm that is O(n logn).Since you will have a sorted array in the end, the "trick" is:During your heapsort identify the point in the code where the first positive integer resides. The number of...
8 Dec 2011
Please look at my comment to the question.Right, you don't need string sorting. You either need to sort on the data set and use binding or using custom order via implementation of IComparer. See this discussion:...
30 Dec 2011
15 Feb 2012
Abbas_here - 2 mins agofrds, The problem is that client saying me to create a web service method which able to consume their SOAP file and return back authenticate result in response SOAP massage, Request SOAP:
2 Apr 2012
Hello All,I am having a column in my datagridview. This column contains "Get Value" in each cell.When I click on the "Get Value" it perform some calculations and display the value in the clicked cell. The result is of Integer type.Now I want to sort it like Integer then the text,...
8 Apr 2012
can we use "dt.Select("group not in (1,2)")"?????
17 Apr 2012
Hello,I have an array of N players in Java. Each player has a position by (X,Y) coordinates.I get as input a new player, with his position.I have to find the K closest players in the array to the input player.How can I do it in Java?I thought about going thru the players array,...
12 May 2012
I have a Books.txt file which looks like this. Book name---------------AuthorLord of the rings---------J. R R TolkiensTom sawyer--------------Mark twainJust after sunset---------Stephen kingThe shining--------------Stephen kingOliver twist------------Charles DickensHuck...
18 May 2012
Alright, now this is what i have. I have used the approach of bubble sorting then binary searching. what i want to do now is to search a particular BOOK from someone without using the bubble sorting or binary searching method and instead search all the records one at a time, from start till the...
18 May 2012
i have seen this version which resembles what i want. can anyone change it to my requirements please?struct book // declare book class{ int no; string author; // type name of string string book; // type name of string string topic; // type name of string ...
21 May 2012
I also wanted to know that is it possible search a particular string/char, having more than one word, by just a single word?? I mean If i want to search 'Lord of the rings' and i just input 'rings', is there any way that i get all the books that contain the word 'rings'?
5 Jun 2012
Gives a run down of how to sort parameters for sharepoint lists selections
10 Jun 2012
You can pass a sort function to JavaScript's array.sort().function sortFunction(a, b) { // your array elements will be passed to this function as a, b // TODO: // compare a to b // if a should come before b, return -1 // if a should come after b, return 1 // if a...
10 Jun 2012
Here is the correct answer..!function MySort(alphabet){ return function(a, b) { var index_a = alphabet.indexOf(a[0]), index_b = alphabet.indexOf(b[0]); if (index_a === index_b) { // same first character, sort regular if (a
15 Jun 2012
bool sortByField1(Task &t1, Task &t2){ if(t1->field1> t2->field1) { return true; } else return false;}and calledstd::sort(vec.begin(), vec.end(), sortByField1);
24 Jul 2012
Hello FRNDS, Please solve my problem facing with GRIDVIEW AND DROPDOWNLIST.Am working on ASp.NET, c#, SqlSERVER2005.On my webpage I have a Dropdownlist and a Gridview...data is dispalying perfectly from database. and this gridview contains PAGING ALSO(it contains Large number of records...
25 Jul 2012
Can anyone help me to convert the following Excel VBA code to C# - this is sorting on cell colour in excel :- There is a table in an excel file with columns as TowerName, Incident, Problem and Change. The column Incident contains values as cell colour in Red, yellow and Green. I need to sort...
25 Jul 2012
Range["E3:H1...
20 Aug 2012
I have an Excel 97-2003 .xls spreadsheet converted from .dbf using C#-4.0 and Excel.Interop. The data is sorted by date according to column D.http://www.tiikoni.com/tis/view/?id=af4cf69[^]Now I would need to sort the selected range (shown in the image), by column G so that blank cells...
16 Aug 2012
Here is how you would sort a sheet based on one column:http://msdn.microsoft.com/en-us/library/wxks80sb.aspx[^]And here is how to filter the collection:http://msdn.microsoft.com/en-us/library/microsoft.office.tools.excel.worksheet.autofilter%28v=vs.80%29.aspx[^]Filter with more than...
7 Sep 2012
In the end I managed to do it like this.A "datagroup" is a group of rows which have the same values in column(D) DATE, grouped by days. "type" is not really relevant, it is just because in my DataSet.Table[0]'s I have a column in which there are two possible values, and according to the...
10 Sep 2012
I am trying to filter comboboxes populated with data from a local sqlserverce database. My task is to select one index in one combobox and have that result filter the next combobox. Would LINQ work for this or can I do it with just plain SQL? I am using Visual Studio 2010/2012 with SQL Server...
10 Sep 2012
11 Sep 2012
The Microsoft documentation is pretty specific on what to implement here:http://msdn.microsoft.com/en-us/library/0868ft3z.aspx[^]
17 Sep 2012
Actually sortingdescription added to my listviewcollection binded with itemsource of grid was getting undone when was getting assigned to grid so I applied my sortdescriptions after binding same to grid and things got done. :)Thanks.
17 Sep 2012
I was binding my list to grid in async method but was applying sorting in normal flow to grid so there were sync issues. therefore i applied sortingdescriptions in async method only after the list get binded to grid. So once grid is fully assigned data from list sortingdescription get added to...
23 Sep 2012
Whenever you are configuring the select statementyou can use ORDER BY button beside the column name selection.There you have to set SORT BY which column.
23 Sep 2012
" SelectCommand="SELECT * FROM [AppSetting] ORDER BY [SettingID]">
1 Oct 2012
Grid View having with various column between those Loan_number is string Field Column when sorting Loan_number column it is not sorted properly.Ex:On Page Load Loan_number Column display as98983982799898398277 9898398278111999777After Sorting Loan_number Column Appeared...
1 Oct 2012
convert loan_number in to numeric if it will not contain alphabet ever.fetch data from sql like below,select convert(numeric,'999') -- replace underline with Loan_Number in your query now, field is numeric so it will apply sorting properly.Happy Coding!:)
1 Oct 2012
2 Options:1. Sort it while retrieving the data from database in the query itself. Similar to this answer: sort date in gridview[^]& this article: How to Non-alphabetically Sort GridView Columns with Text Data[^]2. Sort it in front end as you are doing right now: Use a sortcomparer....
5 Nov 2012
Hi,Is it possible to have interactive sort of detail rows work in an SSRS 2008 matrix report? I have a simple structure as below:Bank | 2002 | 2003 | ----------------------------Bank 1 |2,000 | 2,500 | Bank 2 |2,500 | 2,100 | what i need is to be able to click...
8 Nov 2012
Check the below articles and try to implement the techniques.They will help you for sure.1. how to show the up and down arrows during sorting of column in gridview using asp.net[^].2. A Look at the GridView's New Sorting Styles in ASP.NET 4.0[^].Thanks...
9 Dec 2012
Order values are: 24683579After applying converter on order. we are converting even orders to true and odd orders to false.But when applying...
19 Dec 2012
Note: Numeric conversion is must in this case for sorting AND insert data in proper formatsee below example...select dbo.SetFormat(duration) from( Select '33:14:14' as 'Duration' UNION Select '01:16:36' as 'Duration' UNION Select '0:3' as 'Duration' UNION ...
15 Jan 2013
what comb sort and shell sort exactly do?
15 Jan 2013
Combsort[^]Shellsort[^]...
16 Jan 2013
Hi, I am using Tom John's Drag Drop Treeview [posted here] which works great (Thanks!). However I wish to add functionality to be able to drop nodes in between other nodes and I am unsure of where to start with this. So something like when I drag a node a line representing the drop target is...
16 Jan 2013
11 Feb 2013
Hi,i have a requirement of Gridview with paging and Sorting(on column header click). numeric paging required on both top and bottom side.is there any reference source code or link available? that will helpful to me.thanks
23 Mar 2013
hi..is there any way to ceate a column header click event for grid view in asp.net. I want to click a clumn header of gridview and sort the grid view according go ghe column content. Ex: If that column hase siZe variable, I want to sort the gridview according to sizes..
26 Mar 2013
Hi,I have a DataGrid and bound an ObservableCollection to it:ObservableCollection MyValueList = new ObservableCollection();public MainWindow(){ gridViewReceivedValues.ItemsSource = MyValueList;}If I doMyValueList.Add(SomeValue);the...
27 Mar 2013
29 Mar 2013
hi, i have question about php arrays. i have array like \$data. \$data=array(array('a'='1','b'='2','c'='3','d'='4'), array('a'='5','b'='6','c'='7','d'='8'), array('a'='9','b'='10','c'='11','d'='12') );i want to get...
4 Apr 2013
4 Apr 2013
I believe by setting 'CanSort' as false should do the trick automatically. Quick reference: http://weblogs.asp.net/andrebaltieri/archive/2010/11/02/asp-net-mvc-3-working-with-webgrid-part-2.aspx[^]Try out if that works for a column.
17 Apr 2013
Hi I am getting the paging problem in the mvc3 webgrid footer when tried to sort the grid.In this instance i have a webgrid footer showing page 1 of 1 with two reports in it.When i tried to sort it with a report name, say fr instance, then the footer is displaying as "page 1 of 0".I am...
21 Apr 2013
Dear friends dan vb master,Please help me. I'm newbie at vb. I use visual basic 2010. I have a DataGridSJF with several row. I want to sort it with ascending mode except the first row. the data is at the 3rd column:123521I want the result like this:121235Here...
21 Apr 2013
First of all... it doesn't work does not help much to understand your problem. Please use the widget "improve question" and give a bit more information about what is not working.On the other hand, why are you using "Row.Count - 2" ??If you want to skip the first row, with j = 1 (if...
13 May 2013
- I got a problem when sort column in listview- This is my code:+In class ListViewItemComparer:using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Collections;using System.Windows.Forms;namespace ConvertPTU{ public class...
13 May 2013
Event though your listview has 4 columns, it doesn't automatically generate the subitems. For each item in the listview, you need to make sure that it has enough subitems, and if not, you need to add them (even if their text is empty).I would guess that that is the source of the problem.
17 May 2013
Generating sequential GUIDs in C++ and Qt 5
19 Jun 2013
I would like to design a utility which sorts all words in a Unicode text file and output results into a separate file. Words are separated by spaces or new lines. My text file is very large... Any suggestions?
28 Jul 2013
I have a Datagrid with 'Select' column, having Radiobutton. If sorting is performed on any other column the Radiobutton is loosing its selection.You can check the same kind of question posted on MSDN...
14 Aug 2013
Hi ,After doing lot of R&D in Kendo UI i got that if we want sorting ,filtering and paging on client side we have to add .ServerOperation(false) so that all functionality like Sorting and filtering works on client side.
15 Sep 2013
step 1: I would suggest you to add a uploaddatetime field to your table and capture the uploaded datetime against all the images.step 2: In your select query :"SELECT ime, imethumb, imeslika, kategorija, datum, opis, slikapateka, thumbpateka, userid FROM Ohrid WHERE...
15 Sep 2013
I am using facebox on my asp.net web site for my image gallery. when i am uploading images to the gallery, they are saved on my disc and url data is stored in my sql database. After the uploading, my gallery displays thumbnails from the images but not in the order as they are uploaded. I want to...
19 Sep 2013
Hi,Sorting is not happening on the click of column headers. The "Loading..." shows up briefly over the data, but the columns are not getting sorted. Also, "OnSortCol" event gets triggered and I could see the alert popping up. But, the sorting is not happening. Any help on this is...
1 Oct 2013
Hello,I'm working on a project which parse colomn from a csv file.I store my datas like that :csv file :A1 ; A2 ; A3 ; A4;B1 ; B2 ; B3 ; B4;.. ; .. ; .. ; .. ;My class :public class Restaurant { public double X1 { get; set; } public double X2{...
11 Oct 2013
Both the GridView and ListView are important Data Controls in Visual Studio 2008.Scott Guthrie has a great introduction that uses the ListView
14 Oct 2013
Hi experts,the central part of an application I'm working on is where User can select multiple objects and change some of their properties' values. The UI for that is a PropertyGrid[^].The objects live in an inheritance hirarchy, some being siblings of each other. Some are composed of...
11 Oct 2013
The ListView is a sort of hybrid between a DataGrid and Repeater thatcombines the free form templating of the Repeater with the editingfeatures
14 Oct 2013
Got it!I had read that all of PropertyGrid[^]'s built-in sorting had to be switched off (NoSort[^]) and instead ICustomTypeDescriptor[^]'s GetProperties[^] method should be designed to return the properties in the desired order.What I had overlooked was that the applied Sort()[^] method...
17 Oct 2013
Hi friends, DataView dv = ds.Tables[0].DefaultView; dv.Sort = ViewState["Sort"].ToString();ORds.Tables[0].DefaultView.Sort=ViewState["Sort"].ToString();when i use first command gridview successfully sorted but the second command the gridview not sorting?Where i done a mistake,...
17 Oct 2013
17 Oct 2013
Remove ! in postback and try once:if (IsPostBack) { ViewState["Sort"] = Sort; bind_gridView(); }
17 Oct 2013
I got the Solution :)ds.Tables[0].DefaultView.Sort = ViewState["Sort"].ToString();GridView1.DataSource = ds.Tables[0];Its working me....Thanks for your comment DeenujiThanks and Regards,Somasundharam Arjunan
13 Nov 2013
I'm working in VS2012 on a C# WinForms app. By default when clicking on a column header in a DataGridView it not sorts that column Ascending, you can then click on the column header again to sort it Descending.so the initial click sorts Descending then the second click sorts Ascending and I...
13 Nov 2013
Add this eventprivate void GridViewSortDirection(GridView g, GridViewSortEventArgs e, out SortDirection d, out string f){ f = e.SortExpression; d = e.SortDirection; //Check if GridView control has required Attributes if (g.Attributes["CurrentSortField"] != null &&...
15 Nov 2013
My question is: Can a DataTable have sorting columns. I want to click on the column headers of my GridView that is being populated by a Fill DataTable code. Every time I try to look up Sorting columns they use a DataSet code. If anyone knows of a tutorial or just an answer if this can be...
15 Nov 2013
DataSet is just a collection of DataTables.Unless you are using multiple DataTables, you can always use one DataTable to populate GridView.
15 Nov 2013
Hi. I'm using this code to try and sort my GridView without a DataSource. The problem is I don't think my GridView is getting populated. Whenever I click on the Column header nothing happen. No Error message etc. This is the code I'm using. Please let me know if you need more info from...
15 Nov 2013
http://postimg.org/image/8fm4y...
18 Nov 2013
I’m trying to implement a Sort feature for my GridView that is being populated from a DataTable. Also I have a Filter/Search feature so I can’t use ViewState cause every time the Filter /Search results are displayed and I try to Sort them the Sort displays all the records then Sorts them....
26 Nov 2013
I have a dataset in which there is a column contains various string type values like below:AircraftCrimePackage TotalApartmentsDIC - PersonnelNow the requirement is that after applying sorting logic on this colum if there is a "Package Total" value in it then it must come at the...
27 Nov 2013
Use a primary and secondary sort field. Primary controlled by "Package" and the secondary by the alphabetic order of the other values.insert into sortTest (name) values('Package')insert into sortTest (name) values('Crime')insert into sortTest (name) values('DIC')insert into...
27 Nov 2013
If i understand you well, you have got 2 columns in a result set, for example:NameOfSomething TotalPackage Total 500Aircraft 300Apartments 250Crime 200DIC - Personnel 150If it is a true, you should sort data on the second column.SELECT...
22 Dec 2013
If memeory is the critical factor, then look at External sorting algorithms[^] - but be aware - they will be slower than memory intensive ones.
22 Dec 2013
Hi Friend,Can you do some kind of merge sort with some way where, you are going to do this :1. Create two buffer variables : size depends on you.2. Create a file handle to the input file. You may need to do some heavy temporary data file generation on the disk. So, it's actually...
26 Jan 2014
26 Jan 2014
It seems you are creating a new DataTable in Sorting Event of the Gridview. Instead fetch it from the Datasource DataTable dataTable = GridView1.DataSource as DataTable;Or Can even use a Session for it ,like DataTable dataTable = Session["datatable"] as DataTable; //Session...
27 Jan 2014
5 million strings, each less than 10 characters long (from your sample) is not such a big deal for main memory (50 MB).I suggest that you load the whole file in a large buffer, as contiguous null terminated strings, together with an array of indexes to the start of every string (this will...
11 Feb 2014
Is this a Windows or web app? DataGridView is Windows, but you're talking about ViewState, so I assume you've got a web app with a GridView. Assuming that's the case, you're getting your "Empty" message every time because your grid's data source is nothing on postback (which is normal). If...
11 Feb 2014
Check theseGridView sorting with ViewState off - a solution to double querying and "why doesn't my Sorting event handler fire?"[^]GridView Sorting, Paging without using Session, ViewState or Cache[^]
21 Feb 2014
I need to sort a bunch of elements first by document name and then by the age of the people inside the document.sort(vec.begin(), vec.end(), ltNames);or can i change name into this? documentname+age and then just use ltNames?I would...
26 Feb 2014
It is quite common that one want to sort not only by a single, but multiple properties of an object. This can even be done in a single sorting run. The trick is to use an appropriate compare function.The compare function tells the sorting algorithm, whether one element comes before or after...
26 Feb 2014
Have you looked under the term "Radix sort"? This is the basis behind alphabetical sorting, and it sounds like you need to just have two sorts--one for alphabetical, then one for numeric.The advantage of going for a Radix sort is that a good algorithm maintains the sort from the previous...
2 Mar 2014
There is no automatic way to sort enums into alphabetical order in VS so that:public enum myEnum { aaaa, dddd, eeee, bbbb }becomespublic enum myEnum { aaaa, bbbb, dddd, eeee }If that is what you want, you will have to do it...
2 Mar 2014
I don't think you are using right object for the job. Order of elements in an Enum should be governed by integer value it holds and not by the text. Image a days of week enum that is displayed alphabetically on screen.I think what you need here is a sorted list or dictionary.
3 Mar 2014
There are two different things:1) bind enumeration,2) sort data.Ad 1)Have a look here:How to: Bind to an Enumeration[^]Accessing Enum members in Xaml[^]Ad 2) If enumeration is bind to any control, use its method to sort data.
3 Mar 2014
i hope its useful for you.refer thisC# sort with examples
3 Mar 2014
______________________________...
3 Mar 2014
Have you tried it ? Try yourself then ask question if any problem you faced. ok.Look the link for help:http://stackoverflow.com/questions/9107916/sorting-rows-in-a-data-table[^]Thanks!
4 Mar 2014
Language: C# Windows Form/Console DataTable Shown Below1.Sort the Columns in Ascending Order.(smallest to largest.)2.After sorting find x1 and x2 index number - a. x1 = 0.90*N b. x2 = 0.10*N N= +...