|
YES it finally works, took me about 2 weeks
Nothing is better then making a program work
if your interested this is the XSLT file:
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="@*|node()">
<xsl:sort data-type="number" select="loadorder"/>
</xsl:apply-templates>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
Thx again for the help, it's great that you help so many people (i see your name at almost every question)
|
|
|
|
|
how i can write Ackermann Function not use recursion
Nothing
|
|
|
|
|
Excuse the dumb question:
Why would you want to? It's defined recursively, right? C# supports recursion...so what's the issue?
Bill
|
|
|
|
|
Unless you want to write out MILLIONS of line of code unrolling the function, you best use the recursion...
RageInTheMachine9532
|
|
|
|
|
I would like to call c++ function from managed code as a call back function. How can I implement this feature in csharp? In this case I need to call c++ function after receiving some message in managed code.
|
|
|
|
|
Depends on your implementation. If you just want to call the callback then P/Invoke the exported function and call it in your loop (or whatever). If you want to pass the function as a parameter into some managed method, still P/Invoke the method but create a delegate with a matching signature and pass the delegate - pointing to the P/Invoke'd method, since a delegate is just a managed function pointer - to the method. If a delegate Type is already defined, you'll need to use a sort of thunking method that the delegate "points" to that in turn unwraps or wraps the parameters and calls your P/Invoke'd method.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
I'm having a big problem.
I have a button on my form to sort the datagrid with a dataview. When i click it he sorts the data. That works fine but when i click a row to delete it he uses the rowindex of the datagrid before the sort. So when i click delete then he deletes a row but not the right one. Because the rowindex is not correct.
thx in advance!
|
|
|
|
|
A DataView is used to sort data, even internally by the DataGrid . You must get this DataView and use the "row index" to refer to a row in the DataView , not your original DataTable .
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
but if sort my datagrid with a dataview and then i select a row in the datagrid, how can i know what the rowindex really is? so that he doesn't change or delete a wrong row?
do you understand what mean cause i'm having trouble explaining it in english
thx for your help
|
|
|
|
|
Yes, I understand what you're trying to do - and always have - but I believe it's you that's not understand the solution. If you use the row index in the DataView - it's the row index of the sorted view and that will return you the correct DataRow , which you can use to change information in its columns or remove from the table (by referring to the DataRow itself - forget about the index).
Besides, why do you even care anyway? In the DataGrid , if the user makes any changes the correct data is changed / inserted / deleted. All you need to do is get the DataSet or DataTable from the DataGrid.DataSource property and call DataSet.GetChanges to get a DataSet of just the changes (not required but it does decrease bandwidth consumption and boost performance in a distributed system).
A DataView is just the view on the data. It tracks the DataRow as it sorts and filters them.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Hello everybody
I can get the system date using DateTime.Now()
But how can I set the system date?
Thanks in advance...
|
|
|
|
|
|
And, oddly enough, about every day for the last week it seems! I guess no one cares to search first, which is why they're probably left asking such simple questions.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Maybe we're seeing the bud of a good suggestion for the site, a knowledge base of commonly-asked questions for all categories. It wouldn't eliminate the problem entirely, but a little notice at the top of each forum would probably help, and the base itself would be valuable. We most likely have the biggest brain trust of any programming-related site on the web here. A few simple measures to increase the page ranking of the stuff in the base would probably drive more visitors to the site, too, and instead of getting first results of some half-readable question (sometimes) they'd always get a nice-looking little "articlet".
-Jeff
here, bloggy bloggy
|
|
|
|
|
Nick Parker and I are currently working on a C# FAQ, those his graduation and my activity at work are slowing things down a little. We've already got Chris to agree to post it on the C# forum posting page like there is/was for the C/C++ forum (a FAQ by Mike Dunn).
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Great! Hopefully that'll stem the tide a little. It's important that something like that start off right, with a good content base. Have you thought about letting the community put in content, with the editors having the ability to weed out the bad, or maybe have a little approval process? That'd still give you the chance to edit the content for correctness and wording.
-Jeff
here, bloggy bloggy
|
|
|
|
|
CP doesn't really have the architecture for it - that would be more of a Wiki sort of thing. But we're definitely open to some input.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Well, in the meantime I'm sure that people can always send you an email request if they feel strongly about something. Architectural changes would just make it a little easier in the long run. Maybe you should consider setting up an email account just to receive requests, and post a link to it at the top of the page serving the content. Also, you could pretty easily just create an extra ASP page to take suggestions for the FAQ, which would send it to an email address that you guys could check on an infrequent basis.
Just the word "Wiki" is tantalizing.
-Jeff
here, bloggy bloggy
|
|
|
|
|
|
GOOD IDEA! FAQ I like it.
/\ |_ E X E GG
|
|
|
|
|
Hello,
I'm looking for a better way to update a dataset (update my xml-file actually) when i click a button this is what happens:
if(result == DialogResult.Yes)<br />
{<br />
int del = dtgLibrary.CurrentRowIndex ;<br />
ds.Tables["library"].Rows[del].Delete();<br />
ds.WriteXml(@"c:\library.xml");<br />
ds.ReadXml(@"c:\library.xml"); <br />
btnAddL.Visible=true;<br />
File.Delete(@"c:\library.xml");<br />
}
Is there a better way to do this? because like this you create a file and delete it again
thx in advance
|
|
|
|
|
Why are you reading it back in and then deleting it? The DataSet remains unchanged after using WriteXml . If you want to accept changes made to the DataSet , call DataSet.AcceptChanges() .
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
I want to associate a contextMenu control not with a whole TreeView control, but with a certain element(TreeNode) so that the options of the contextMenu depend on the item and its level in the TreeView. Do I need only one contextMenu and update it at runtime through code (handling its popup event?)? Or can I have more contextMenus? (and in this case how can I associate them with the different nodes of the TreeView).
I hope I have been clear enough and not give you head aches.
Thank you in advance.
Best regards,
Cristina
|
|
|
|
|
Cristina,
I am doing something like this right now actually.
Since the TreeNodes don't have a ContextMenu associtated with them, the thing to do is change the ContextMenu associate with the parent TreeView based on where the cursor is. Do this by handling the MouseMove event on the TreeView control. I derive a new class of TreeNode for each "kind" of node I use. This lets you use the node type to decide which menu to show.
Something like:
private void treeView1_MouseMove(object sender, System.Windows.Forms.MouseEventArgs e)
{
TreeNode tn=treeView1.GetNodeAt(treeView1.PointToClient(System.Windows.Forms.Cursor.Position));
if (tn!=null)
{
switch (tn.GetType ().ToString ())
{
case "DerivedTreeNodeClass1":
this.ContextMenu = ContextMenu1;
break;
case "DerivedTreeNodeClass2":
this.ContextMenu = ContextMenu2;
break;
default:
this.ContextMenu = DefaultContextMene;
break;
}
}
else
{
this.ContextMenu = null;
}
}
You can use the same idea and handle it on popup too...at least I can't think of a reason why that wouldn't work. You also don't need to derive new TreeNode classes. You just need some way to tell, from the node itself, what menu you need to show.
Hope this helps,
Bill
|
|
|
|
|
An alternate technique is to handle the ContextMenu object's Popup event, and manually add and remove menu items as appropriate. See the documentation for ContextMenu.Popup .
Stability. What an interesting concept. -- Chris Maunder
|
|
|
|