|
You might want to give an example of what you're talking about. I don't have a any idea of what you're trying to do.
And what's with the "I heart this and that" garbage??
|
|
|
|
|
Dave Kreskowiak wrote: what's with the "I heart this and that"
I think OP means "I heard ... "
Just say 'NO' to evaluated arguments for diadic functions! Ash
|
|
|
|
|
Since you can use WMI from C# (ManagmentObjects), you can per definitionem do at least all that can be done with WMI. Since you can also use native dlls from C# you can do already more than WMI alone. Q.E.D
Cheers!
|
|
|
|
|
What the heck is "Native C#"?????
We normally call C and most C++ native (and unmanaged), and C#, VB.NET and C++/CLI managed (and not native).
|
|
|
|
|
Luc Pattyn wrote: What the heck is "Native C#"?????
The local version of C#. It's native to him.
All the best,
Dan
|
|
|
|
|
Dear ALL
Now i have a col . contains for example the following PC1 PC2 PC10 PC100 , if u tried to sort it , it will be PC1 PC10 PC100 PC2 so how to make it sort as it sort numbers to be PC1 PC2 PC10 PC100
my datagridview is binded to a datasource so i can't use SortCompare(object sender, DataGridViewSortCompareEventArgs e)
so any tips
thanks all
bye
|
|
|
|
|
Sort the data before it is bound. You will need to implement a custom IComparer
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
|
Yes, wait for .NET Framework 5.0 and hope they have implemented your specific sorting requirements into the DataGridView control.
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
Daoist Coding and Sarcasm, I like it!
|
|
|
|
|
Sarcasm?
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
If you're able to control the format of the data, you can achieve what you want by padding the small numbers with leading zeros:
PC001
PC002
PC010
PC100
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
And what if the data needs to be displayed as is without leading zeros?
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
You can have a seperate column in the datatable that contains a normalized version of the display data. This normalized version could be used for sorting.
Then, when you bind the grid to the table, you simply don't include this sort column in the bindings.
|
|
|
|
|
Yes, of course. I was trying to point out to the OP is isn't as simple as just changing the data in the column.
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
Yeah, some people just don't want to write code to solve problems anymore. They think that the .NET Framework can read minds and do everything you intended with just a few statements.
|
|
|
|
|
He asked for an easier solution and I suggested one.
It's up to him to decide whether it works for his particular case. He didn't introduce that additional requirement, you did.
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
An "easy" solution that ignores potential pitfalls is not good advice, but, yes, it is up to the OP.
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
Normalize the numbers?
Read the table from a view instead of directly and have a new computed column containing the data as PC001, PC002, PC010, PC100, etc.
Sort on that, but don't show it.
|
|
|
|
|
So now you need to create a process in SQL Server to create the column and format the strings so they can be sorted. What happens when there are more than three digits? What happens when the business logic changes or the field changes?
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
Mark Nischalke wrote: What happens when there are more than three digits?
Um...you take 15 seconds to increase the size in function? Or set it to left-pad with zeros out to 20* places from the get-go and not worry about it? (* or whatever is reasonable)
Mark Nischalke wrote: What happens when the business logic changes or the field changes?
Well, that changes more than this little bit, so why worry about it since a boatload of stuff will need to be rewritten, anyway?
And, if that happened, you'd be rewriting any custom sorting in the program itself if you made your own comparer there. Me, I'd rather avoid that and just change a view.
|
|
|
|
|
GenJerDan wrote: you'd be rewriting any custom sorting in the program itself if you made your own comparer there.
Not quite. Had similar requirements and wrote the comparer well enough the first time, no need to keep updating it.
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
well thx all
well i guess the easiest way that i will recode my code by using the datagridview without the databinding so i can use
SortCompare(object sender, DataGridViewSortCompareEventArgs e)
thanks anyway all
and thanks also to whom comment on my Q in a funny way
bye
|
|
|
|
|
|
Hello,
I search a free TSA server, there are one ?
Thank you verry mutch.
|
|
|
|