|
Get rid of the spaces after the order attribute and the = sign.
Also, why are you going to these lengths to sort data? Simple create a DataView on your DataTable and call Sort . Use that DataView for data binding then. It works in place of a DataTable . If you use DataGridTableStyle s, you still use the table name for the DataGridTableStyle.MappingName property.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
the spaces are not the problem because i'm doing the exact same thing a second datagrid. I have made a private to sort the xml with a parameter (ascending or descending). In the first datagrid he sorts descending and when i do the same thing in the second datagrid he doesn't do it and sorts ascending instead.
|
|
|
|
|
Have you actually stepped through your code to make sure that the DataTable contains the sorted data? A DataGrid can apply a default sort based on the DataTable 's DefaultView . This why you're supposed to use a DataView on your DataTable and bind against that like so:
DataView view = new DataView(dataTable1);
view.Sort = "MyColumn DESC";
dataGrid1.DataSource = view; See the DataView.Sort property documentation in the .NET Framework SDK for more information.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
ok thx!
is it also possible that he wont sort it because i'm sorting my xml on an attribute?
|
|
|
|
|
If you're sorting against an attribute, you should use "@name", not just "name". I didn't catch that before. Still, a DataView is the best way and most efficient way to go. Why go to all the trouble of using an XSL Transform just to sort data and have to read it back in?
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
yesss thx! the @ was the problem.
I know that a dataview is easier but last time i had problems with it so i wrote a Xslt-file. Now i can re-use that code so it's just copy paste now, except the problem with the @
|
|
|
|
|
Hi,
I have a treeView Control. I am adding a node with text . The text is very large one. It is giveing scroll bar for the tree view but all the text is not visible (the text is very large around 1000characters). How can I change the properties to make the entire text visible.
Karteek
|
|
|
|
|
Why on earth would you put a string that long in a TreeView? That is more like detail that should be displayed on some other control. I'm just saying this because if I saw an application do something like that, the first thought in my head would be "WHAT WERE THE DEV's THINKING WHEN THEY DID THIS?!?!"
Now, the TreeView control doesn't support putting huge strings on multiple lines in a single node. You COULD break up that string into multiple nodes under the same parent node. Or you could attempt to ownerdraw the TreeView, but that's not exactly easy. Another option would be to check out an alternate TreeView control from, say, Infragistics...
RageInTheMachine9532
"...a pungent, gastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hi,
I usually don't have such long strings in my control but in some case I amy get such strings. So I want this.
Karteek.
|
|
|
|
|
You may want it, but would anyone else want to use it?
RageInTheMachine9532
"...a pungent, gastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hi,
Actually I am reading the input for the tree from a file . So I can have any type of text in the file.
Karteek
|
|
|
|
|
Hi
Im creating a service application which has the job of watching if my main application is running.
If my application is not running, I wish to start it, but this is where my problems ocures.
It seems that my service application correctly sees that my program is not running, but when it starts the program it just never shows up.
If i take a look in my process list, the program has been started but the GUI (a simple form) is just never shown.
I have a feeling that its because the process is also started in the context of the windows service, and therefor does not support a GUI.
If i run my code in a standard windows app, it works just fine.
Has anyone got any sugestions?
Heres the code I use to check and start up my application:
Process[] processes = Process.GetProcessesByName("WindowsApplication4");
if(processes.Length != 1)
{
Process tallyMachine = new Process();
tallyMachine.StartInfo.FileName = "C:\\WindowsApplication4\\WindowsApplication4.exe";
tallyMachine.StartInfo.WorkingDirectory = "C:\\WindowsApplication4";
tallyMachine.Start();
}
Any help would be greatly appreciated
Regards
Janus Klok
|
|
|
|
|
Hi,
Try this...
tallyMachine.startInfo.WindowStyle = ProcessWindowStyle.Maximized;
Add this line in your code and see if it works...
Hope this solves your prob...
regards,
Aryadip.
Cheers !! and have a Funky day !!
|
|
|
|
|
Thank you for your sugestion.
I havent tried it thoug as the other solution wich is postet to this problem, solved the problem.
Regards
Janus
|
|
|
|
|
Klok wrote:
I have a feeling that its because the process is also started in the context of the windows service, and therefor does not support a GUI.
Your absolutely right! This IS what's happening!
To fix this this, try going into the Services manager, click the Properties of your service, change the logon to "Local System Account", then enable "Allow service to interact with desktop". This should take care it.
RageInTheMachine9532
"...a pungent, gastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Great
This works absolutly perfect.
Thank you very much.
Regards
Janus
|
|
|
|
|
Another alternative is to set the credentials of the service to a user with "Log on Locally" and "Log in as a Service" rights. What Dave said is perfectly fine, but it runs with SYSTEM privileges. Just something to think about depending on what your application does.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
I'am trying to retrieve a graphics object from an image object using the piece of code given below
Graphics GDC = Graphics.Getimage(objImage)
But it is throwing the exception...graphics cannot b retrieved from an image having INDEXED PIXEL FORMAT.Cud u tell me the reason y???
Nature of my work:
I'am trying 2 draw some shapes on 2 an image in a picturebox control.After drawing the image i need 2 rotate the image.While rotating i need my drawings also 2 b rotated.
I have tried it with all sort of transformations and then also itz not working.So i thought of retrieving the graphics object from the image and draw the shape(rectangle) using that so that while i'am rotating the image the drawing is also rotated.
Pleez help me as i'm less xperienced in C#
Regards,
MMX
|
|
|
|
|
|
Then how do u retrieve the graphics handle of an image object which is having an indexed pixel format!!!!
Regards,
Mmx
|
|
|
|
|
Hi,
Has anyone made some examples/functions for combining bitmaps? I have one simple program that can seperates a color picture into C,M,Y,K colors picture.
Now I want to combine these pictures into one picture under C#, and finally convert it to *.jpg.
So anyone knows how to do this process..?
THanks for your kindly help..
|
|
|
|
|
|
yes.. it is alpha blend images.
e.g. I used the simple program to seperate the color image into C,M,Y,K 4 images. They are same, but different color seperation layers
Now I wnat to generate a correct color image as same as origion one in C#, and then preview it. I don't know how can I do this blending process..
Can you help me ? Thank you
|
|
|
|
|
Check out Joe Pardue's tutorial on alpha blending here http://www.codeproject.com/cs/media/CsTranspTutorial1.asp
or Rakesh Rajan's article here
http://www.codeproject.com/cs/media/alphafx.asp
|
|
|
|
|
Hello!
I want to create a method that connects to a sql db and retrives some values. I want the connection in a method so I can reuse the code. My question is if I can return a data in the same way you return a string or int? And how do i do this?
|
|
|
|