|
That looks like you've assigned it to the File item, not the Computer item.
|
|
|
|
|
The computer item is a subitem of the file menu. So how can I assign it to the computer item. How can I fix that?
|
|
|
|
|
mfcuser wrote: how can I assign it to the computer item.
MainMenu mainMenu1 = new MainMenu();
MenuItem menuItem1 = new MenuItem("&File");
menuItem1.MenuItems.Add("Data");
<code>MenuItem computerMenuItem = new MenuItem("Computer");
menuItem1.MenuItems.Add(computerMenuItem);</code>
menuItem1.MenuItems.Add("Keyboard");
menuItem1.MenuItems.Add("Telephone");
<code>computerMenuItem</code>.Click += new EventHandler(OnComputer);
void OnComputer(object sender, EventArgs e)
{
MessageBox.Show("You click on computer", "Computer Click");
} /ravi
|
|
|
|
|
It is working fine now. About if I have several menu items. There must be a way to pack them to an array rather than doing it one by one. So the way I had "Data", "Keyboard", "Telephone" was incorrect. The menu items need to have their own variable to identify them rather than single string.
|
|
|
|
|
I m going to develop cd burning program
I m using acclImapiwrapper; it returns error at DiscMaster.RecordDisc(bool simulate, bool ejectwhencomplete) method and the error code is 0x80040220.
It may be due to a lot of events called during disc record but how can i control them
Can any help me this regard.
Raza Hussain
|
|
|
|
|
Raza Hussain wrote: acclImapiwrapper
What is acclImapiwrapper?
|
|
|
|
|
acclImapiwrapper; it is dll file.
Raza Hussain
|
|
|
|
|
Will this[^] article help? (Apologies if you've already seen it).
/ravi
|
|
|
|
|
Hi friends,
I have a simple problem. I tried my best but couldn't find a way to do. hope you people will know it. I defined a variable or param in xsl file by using following tags <xsl:variable> or <xsl:param> now I want to use value of this in .cs file of my project by using c#. Will any of you tell me solution of it? I will be really thankful to you people.
Greetings,
Abubakar
|
|
|
|
|
Please don't double post.
the last thing I want to see is some pasty-faced geek with skin so pale that it's almost translucent trying to bump parts with a partner - John Simmons / outlaw programmer
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
If on the other hand you are unhappy with a posting, please modify it instead of posting a new one in a new thread. You can do this by clicking on the modify link in the bottom right corner of a posting.
Regarding your problem, I'm not sure whether I really get what you are trying. If you want to retrieve the specific value from the XSL file at runtime, you could use the XmlDocument or XmlTextReader as the file is (or at least should be) a valid XML file.
"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 www.troschuetz.de
|
|
|
|
|
I'm not sure if this is possible, but I need to call a method in a running program from a different program. The method I want to call is being loaded into the remote EXE via a DLL. If I try using DllImport, it does call the method, but it doesn't work correctly. The method is supposed to return its class's member information, but if I use the DllImport from C# to call the method, it doesn't return the actual remote class's members, just some garbage values. Also, the program and DLL are already compiled, were written in C++, and don't include support for .NET remoting.
For example, TestApp has a class called TestClass. This class has a bool called TestMember and a method called TestMethod that returns the value of TestMember. When I write a program and use DllImport to import TestMethod, it returns true, even when I know that the remote member is actually false. It does this with all of the methods I try to import. I'm guessing it has something to do with the fact that TestMember and TestMethod belong to an instance of an object rather than being static.
I would appreciate if someone could point me in the right direction to figuring this out. Using C++ is ok too, but I'm more comfortable with C#.
|
|
|
|
|
Are both applications .NET applications? Doing "remote procedure calls" can be done, but differs depending on the technologies being used. If both apps are .NET apps, use System.Runtime.Remoting, using an IpcChannel (inter-process communication channel). There are a few articles on CP on how to do this.
|
|
|
|
|
|
Hi friends,
I have a simple problem. I tried my best but couldn't find a way to do. hope you people will know it. I want to define a vaiable <xsl:variable> or param <xsl:param> in xsl file then I want to access value of this in .cs file of my project by using c#. Will any of you tell me solution of it? I will be really thankful to you people.
Greetings,
Abubakar
|
|
|
|
|
In your xsl, you define a parameter with <xsl:param> and reference it with the $prefix.
So, suppose you wanted a MyName parameter, you would create it like this:
<xsl:param name="MyName" />
Then, you would reference it via:
<xsl:value-of select="$MyName" />
To reference this from your C#, you need to add parameters:
XsltArgumentList args = new XsltArgumentList();
args.AddParam("MyName", string.Empty, "John Doe");
These parameters are then added into the Xsl transform, then you will use:
xslt.Transform(xpathdoc, args, writer);
the last thing I want to see is some pasty-faced geek with skin so pale that it's almost translucent trying to bump parts with a partner - John Simmons / outlaw programmer
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
HI,
Thanks for so quick reply. You didn't get my problem. The code which you sent me I already used that code. it is passing values from c# to XSL by using this but not from XSL to C# which I need;
XsltArgumentList args = new XsltArgumentList();
args.AddParam("MyName", string.Empty, "John Doe");
I explain it you in more details and comprehensively; I have a variable in xsl with name 'size' and it has value 35.I just want to use this value in .cs file by using following statement;
Response.Write(size);
output should be;
35
Waiting for your reply,
Regards,
Abubakar
|
|
|
|
|
Read it using an XPath query then. That's the best way to get values out. BTW - you don't need to use xsl to achieve this.
the last thing I want to see is some pasty-faced geek with skin so pale that it's almost translucent trying to bump parts with a partner - John Simmons / outlaw programmer
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
HI,
It will be really nice if you give me some of examples of using param or variable in .cs file from XSL. I tried my best but couldnot find any way. please give me some practical example in form of code.
Regards,
Abubakar
|
|
|
|
|
Thinking about it, I'm not sure what you are trying to achieve. Why do you have a variable in the XSL file that you need to read? Are you trying to read the result of a value transformation in XML? If you provide your requirements in more depth then perhaps I can help.
the last thing I want to see is some pasty-faced geek with skin so pale that it's almost translucent trying to bump parts with a partner - John Simmons / outlaw programmer
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
I tried but couldn't find a solution. I try to send you code of XSL file. xsl file name is "test.xsl" and param is defined just like that without commas "<xsl:param name="testParam">TestValue</xsl:param>" please send me c# lines of code to get value of this param in .cs file.
Regards,
Abubakar
|
|
|
|
|
Right, suppose that you have the following xslt file:
<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:param name="testParam">Test value</xsl:param>
</xsl:stylesheet>
To read this in, you could do the following:
public void WriteToConsole()
{
XmlDocument doc = new XmlDocument();
doc.Load("../../MyTest.xslt");
XmlNamespaceManager mgr = new XmlNamespaceManager(doc.NameTable);
string xsltMgr = "xsl";
string xsltUri = "http://www.w3.org/1999/XSL/Transform";
mgr.AddNamespace(xsltMgr, xsltUri);
try
{
XmlNode node = doc.SelectSingleNode("//xsl:param[@name='testParam']", mgr);
Console.WriteLine(node.InnerText);
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
}
the last thing I want to see is some pasty-faced geek with skin so pale that it's almost translucent trying to bump parts with a partner - John Simmons / outlaw programmer
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
Thanks a lot for your reply it works fine with static values but still I don't solve my problem as I have dynamic values. I am going to send you code of my xsl param if it is possible please send me code again. I will be greatful to you. here is code;
<xsl:param name="size" select="ceiling(count(.//Category[Title=$subtitle]/Category/MetaData))"/>
Waiting for your reply.
Abubakar
|
|
|
|
|
What is setting $subtitle?
You have an XML document which you are processing the xslt against, then you can apply the XPath query that is in the select statement against the xml, passing in the relevant item for $subtitle. This is the quickest and easiest way to get the value out. I already intimated that the XPath would be a better approach for this problem.
The following XPath solves your problem:
private int GetValue(string xmlFile, string title)
{
XPathDocument doc = new XPathDocument(xmlFile);
XPathNavigator nav = doc.CreateNavigator();
XPathExpression expr = nav.Compile(string.Format(
"ceiling(count(//Category[Title='{0}']/Category1/MetaData))", title);
object obj = nav.Evaluate(expr);
int output = 0;
if (obj != null)
{
output = Convert.ToInt32(obj);
}
return output;
}
the last thing I want to see is some pasty-faced geek with skin so pale that it's almost translucent trying to bump parts with a partner - John Simmons / outlaw programmer
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
Abubakar
Did the sample I suggested solve your problem? If so, it would be nice for you to let people know.
the last thing I want to see is some pasty-faced geek with skin so pale that it's almost translucent trying to bump parts with a partner - John Simmons / outlaw programmer
Deja View - the feeling that you've seen this post before.
|
|
|
|