|
Try using the NodeMouseClick event.
Extract the clicked node from the e argument passed to the event, and call its Expand() method.
Regards,
Shy.
|
|
|
|
|
Sorry, I forgot to mention my application is a WPF application, so there isn't a NodeMouseClick event...
|
|
|
|
|
No... you did not...
I'm the one who didn't see it...
|
|
|
|
|
|
I'm using Visual C# Express Edition and the XNA Game Studio add-on.
If I want to include a System.X file by just writing "using System.X.Y" in the top of the program the compiler says he cannot find the files. I heard that there is another possibility to include the files so that's working (that should work somehow with the menu). If anyone knows how it works please write it in the message board.
Thanks.
Ich benutze Visual C# Express Edition mit der XNA-Game-Studios Erweiterung.
Wenn ich eine System.X-Datei einbinden will, und nur "using System.X" am Anfang des Programms schreibe, meldet der Compiler, er finde die Dateien nicht. Ich habe gehört, es gebe auch noch eine andere Möglichkeit die Dateien einzubinden (soll irgendwie über das Menü funktionieren).
Ich habe bis jetzt noch nicht herausgefunden, wie das funktioniert. Wenn es jemand weiß, bitte ins Forum schreiben.
Danke im Voraus.
|
|
|
|
|
Writing using This.That; doesn't include anything in your project.
It's just a shortcut for writing This.That. in front of every class living in this namespace.
You'll have to add a reference to the assembly containing these classes via the project explorer ("Add reference..."/"Verweis hinzufügen...") so that the compiler is able to find the corresponding classes.
Regards,
mav
--
Black holes are the places where God divided by 0...
|
|
|
|
|
Hi!
I have a question:
How i can download the email from POP3 server?
Thanks, Bye!
Bye
|
|
|
|
|
|
Hi!
First I suggest you read what POP3 is: http://en.wikipedia.org/wiki/POP3
You'll see that it's just a bunch of ascii commands being sent to a given port (usually 110) on the POP3 server.
If you plan to implement such a class yourself you can simply take a TcpClient as base class to perform the actual communication with the server.
...Or you just follow the suggestion from martin_hughes (posted while I was still typing)
Regards,
mav
--
Black holes are the places where God divided by 0...
|
|
|
|
|
I have written an XML file using this code
private void AddBook(string ISBN, string title, string author)
{
if (booksElement == null)
{
booksElement = xmlDoc.CreateElement("Books");
}
XmlElement bookElement = xmlDoc.CreateElement("Book");
XmlAttribute bookAttribute = xmlDoc.CreateAttribute("ISBN");
bookElement.SetAttributeNode(bookAttribute);
bookAttribute.Value = ISBN;
XmlElement titleElement = xmlDoc.CreateElement("title");
titleElement.InnerText = title;
bookElement.AppendChild(titleElement);
XmlElement authorElement = xmlDoc.CreateElement("author");
authorElement.InnerText = author;
bookElement.AppendChild(authorElement);
booksElement.AppendChild(bookElement);
xmlDoc.AppendChild(booksElement);
xmlDoc.Save(path);
}
it works fine for a new book, but I cannot OPEN an existing xml file and add a book (node) to it.
How do I append a node??
_____________________________________________________
Yea! I could be wrong...
|
|
|
|
|
Hi!
You didn't show how you create the xmlDoc object, but XmlDocument has a Load() method you can use to open an existing xml file.
If you do open an existing file, you don't have to create the root entry (I guess it's booksElement , but can use xmlDoc.SelectSingleNode("/Books") to retrieve a reference to the existing node.
Regards,
mav
--
Black holes are the places where God divided by 0...
|
|
|
|
|
I'm sorry I posted only the function of creating one node...
I grabbed code from www.kirupa.com , all of it is here..
private XmlDocument xmlDoc = new XmlDocument();
private XmlElement booksElement;
private void AddBook(string ISBN, string title, string author)
{
if (booksElement == null)
{
booksElement = xmlDoc.CreateElement("Books");
}
XmlElement bookElement = xmlDoc.CreateElement("Book");
XmlAttribute bookAttribute = xmlDoc.CreateAttribute("ISBN");
bookElement.SetAttributeNode(bookAttribute);
bookAttribute.Value = ISBN;
XmlElement titleElement = xmlDoc.CreateElement("title");
titleElement.InnerText = title;
bookElement.AppendChild(titleElement);
XmlElement authorElement = xmlDoc.CreateElement("author");
authorElement.InnerText = author;
bookElement.AppendChild(authorElement);
booksElement.AppendChild(bookElement);
}
private void WriteToDisk(string path)
{
xmlDoc.AppendChild(booksElement);
xmlDoc.Save(path);
}
static void Main(string[] args)
{
Program bookList = new Program();
bookList.AddBook("0553212419", "Sherlock Holmes: Complete Novels and Stories, Vol 1", "Sir Arthur Conan Doyle");
bookList.AddBook("0743273567", "The Great Gatsby", "F. Scott Fitzgerald");
bookList.AddBook("0684826976", "Undaunted Courage", "Stephen E. Ambrose");
bookList.AddBook("0743203178", "Nothing Like It In the World", "Stephen E. Ambrose");
bookList.WriteToDisk(@"C:\books.xml");
}
So you see this creates a file OK.... But If I cannot ue this function to Append to the saved books.xml file.
meanwhile, I try the SelectSingleNode, and see if it works.
_____________________________________________________
Yea! I could be wrong...
|
|
|
|
|
Hi,there
I have a window application in C# (vs2003), I have one form class(Form1) and the Main[] located in the other class - MyProjectMain,
how do I pass variable between those two classes, for example I want to pass the arg[] that Main[] gets and populate in textBox1 of Form1?
Thanks a lot for your help,
namespace MyProject1
{
public class Form1 : System.Windows.Forms.Form
{
private System.Windows.Forms.TextBox textBox1;
}
...
}
namespace MyProject1
{
public class MyprojectMain
{
[STAThread]
public static void Main(string[] args)
{
Application.Run(new Form1());
}
}
|
|
|
|
|
Put a parameter in the constructor of the form:
public Form1(string[] args)
Pass the arguments when creating the form:
Application.Run(new Form1(args));
---
single minded; short sighted; long gone;
|
|
|
|
|
Thanks,
but in general, how do I pass variables between classes in a window application? Do I always have to pass as arguments? or there are some namespace level variable I can use? I was a VB programmer so I've been spoiled that there are always application level variables to use.
|
|
|
|
|
Just make it public
You can make it static to pass it through the class name
or you can create an instance from class2 into class1 to access non static members
Mohamed Gouda
Egypt
|
|
|
|
|
Mohammed Gouda wrote: Just make it public
Make what public? A field on the class. That is extremely bad practice: see Why make fields in a class private, why not just make them public?[^] and The public fields debate again[^]
Mohammed Gouda wrote: You can make it static to pass it through the class name
And what happens when you have many instances of the same class? You pass the value to the static field and then you immediately affect all instances of the class rather than the one you are interested in.
Mohammed Gouda wrote: you can create an instance from class2 into class1 to access non static members
I just don't understand where you are going with that.
Upcoming events:
* Glasgow: Mock Objects, SQL Server CLR Integration, Reporting Services, db4o, Dependency Injection with Spring ...
"I wouldn't say boo to a goose. I'm not a coward, I just realise that it would be largely pointless."
Ready to Give up - Your help will be much appreciated.
My website
|
|
|
|
|
Hey !!
Colin Angus Mackay wrote: That is extremely bad practice
Thanks
One of your solutions is using properties (get and set)
Can you plz explain the difference between creating a Read/Write property for a private member AND making that member public?
I think making a Read/Write property is a redundant code (MAY BE I AM WRONG)
And when I diside to make a Read/Write property this means I will permit external Read/Write acces to the member (which can be achieved shortly be the keyword public)
Mohamed Gouda
Egypt
|
|
|
|
|
Sure,
if you want to allow someone to set a text in one of your labels, you could:
1. provide a public property (or method) that does exactly that; this is good
2. make the label public, or provide a public property that gets a reference to the label,
so the caller itself can set the text. this is bad. Why ? because now the caller can
do many more things to your label, such as moving it around, changing its color, etc,
all things you did not intend to allow.
Hence: provide public properties/methods to do exactly what is needed, no more, no less.
|
|
|
|
|
Mohammed Gouda wrote: Can you plz explain the difference between creating a Read/Write property for a private member AND making that member public?
Read the links I gave you.
Mohammed Gouda wrote: And when I diside to make a Read/Write property this means I will permit external Read/Write acces to the member (which can be achieved shortly be the keyword public)
You are not granting read/write directly to the field, you are offering a way to access the field. If you read the links I gave you then you would already be aware of the advantages of that. In fact, there might not even be a field there at all. You are also giving your class the opportunity to veto any value that the outside class attempts to set on the field.
In short, there are vary few situations where making a field public is acceptable. Again, you would have seen that if you read the links I gave.
Upcoming events:
* Glasgow: Mock Objects, SQL Server CLR Integration, Reporting Services, db4o, Dependency Injection with Spring ...
"I wouldn't say boo to a goose. I'm not a coward, I just realise that it would be largely pointless."
Ready to Give up - Your help will be much appreciated.
My website
|
|
|
|
|
mhp130 wrote: but in general, how do I pass variables between classes in a window application?
Regardless of application type you can pass variables through constructor parameters, method parameters or properties.
mhp130 wrote: or there are some namespace level variable I can use?
Good grief no! That is extremely bad practice.
mhp130 wrote: I was a VB programmer so I've been spoiled that there are always application level variables to use.
That's not being spoiled, that's picking up bad habits... Which I suppose happens if you get spoiled also..
Upcoming events:
* Glasgow: Mock Objects, SQL Server CLR Integration, Reporting Services, db4o, Dependency Injection with Spring ...
"I wouldn't say boo to a goose. I'm not a coward, I just realise that it would be largely pointless."
Ready to Give up - Your help will be much appreciated.
My website
|
|
|
|
|
How to embedd a Windows form in a Webform
f
|
|
|
|
|
ankit_mait wrote: How to embedd a Windows form in a Webform
Can we?
FYI, you can not. By the way, if you post what exactly you wanna do, thn some can help you
|
|
|
|
|
Yeah you can. It's generally not a good idea, but you can.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
I actually want to create an online Sudoku Solver so i thought i can create a windows application and then embedd it in an Webform...
This seems a little foolish but actually i have a 4 day time constraint and even if i cant create the webform i can atleast show an application to my professor
|
|
|
|