|
All you should have to do is Serialize the root node; it should then serialize everything referenced in that node; including its child nodes.
When you deserialize only worry about the first node; the rest should come with it.
James
"Java is free - and worth every penny." - Christian Graus
|
|
|
|
|
Try running this (and look at the y and z definitions):
using System.IO;
using System.Runtime;
using System.Runtime.Serialization;
using System.Runtime.Serialization.Formatters;
using System.Runtime.Serialization.Formatters.Binary;
.
.
.
TreeNode x,y,z;
x = new TreeNode("Root");
y = x.Nodes.Add("A"); //it only runs if you comment out these lines
z = y.Nodes.Add("1"); //it only runs if you comment out these lines
IFormatter formatter = new BinaryFormatter();
Stream mystream = new FileStream("MyFile.bin", FileMode.Create, FileAccess.Write, FileShare.None);
formatter.Serialize(mystream, x);
mystream.Close();
TreeNode root;
mystream = new FileStream("MyFile.bin", FileMode.Open, FileAccess.Read, FileShare.Read);
root = (TreeNode)formatter.Deserialize(mystream);
MessageBox.Show(root.Text);
Thanks for the help
|
|
|
|
|
Has anyone had any luck getting TAPI to work with C#? I'm running into some fairly strange problems.
I added the Telephony class to my toolbox, then dragged an XTel object to my form. Then I added a button. Here's the method I attached to the buttons click event:
private void callButtonClick(object sender, System.EventArgs e)
{
axPhone.ChooseEngineDialog();
axPhone.CallDialog();
}
Everything compiles fine and comes up. Then I click the button and I get the Speech Engines for the Telephone dialog box. COOL. The next thing I should see would be the Call Dialog but instead I get an error:
System.NullReferenceException: Object reference not set to an instance of an object.
huh?
Some things I can do. I can set the AnswerAfterRings property and I can get the MaxLines property. However if I try the MakeCall() method directly I get the NullReferenceException again.
I did a search for TAPI here and found S.S. Ahmed's VB Tapi program, and that works fine for me.
I'm sooooooooooo confused.
|
|
|
|
|
I want to put a bitmap file as a resource, then load it into a varialbe, so that it can be set as a forms background. but this has two problems.
1. I dont have the luxury of the vs.net resource editor [i use SharpDevelop]
2. I dont know how to load it from resource.
any help plz?
Email: theeclypse@hotmail.com URL: http://www.onyeyiri.co.uk "All programmers are playwrights and all computers are lousy actors."
|
|
|
|
|
I'm a little tired right now, but back when we were having the screensaver contest I was reviewing JTJ and CG's source for their entry. They did that, here is the link to their article, you will need to download it and read through the file. Your answer somewhere in here
Nick Parker
|
|
|
|
|
I don't know how you would do it in SharpDevelop; but on the commandline you can add bitmap resources.
csc [other options] /resource:mybitmap.bmp,mynamespace.othergarbage.mybitmap.bmp
To load that bitmap at runtime you need to first understand how the resource loading Bitmap constructor works.
Bitmap(Type namespace, string filename);
It takes an instance of a Type, and a filename. The only thing that the Type is used for is to get the namespace of that type; it then prepends the filename with it.
So if you passed in an instance of a Type for the class MyCompany.Foo, and a filename of "whatup.bmp" the bitmap it will look for will be named "MyCompany.whatup.bmp", this name is what the second part of the /resource compiler option does.
Understanding how this works is by far the trickiest part to learn; and I haven't learned how to explain it in plain english yet
HTH,
James
"Java is free - and worth every penny." - Christian Graus
|
|
|
|
|
|
I don't suppose anyone knows of an HTTPS class? I know /n software have got their IP*Works library (which includes an HTTPS module amongst others) but I only want the HTTPS support, and it seems prohibitively expensive!
Alternatively, I guess I'm going to have to knuckle down and write my own lol
Thanks,
Paul
|
|
|
|
|
Hy guys, I try to build e Toolbar for IE with this example:
http://www.codeproject.com/csharp/dotnetbandobjects.asp
I would like to insert a textbox but when I press backspace don't delete the character.
Why?
Please help me
|
|
|
|
|
It's because IE uses that to navigate backward. I still haven't found an answer.
http://www.knowledgegeek.com - Come on! I need the Traffic!
|
|
|
|
|
Hi all, can someone please post an example of how to use the FlagsAttribute, specifically setting and unsetting the flags?
My code:
[Flags]
public enum StringFormat
{
Normal = 1,
Bold = 2,
Underline = 4,
Inverse = 8,
Color = 16,
}
In my class:
StringFormat format = StringFormat.Normal;
format = format | StringFormat.Bold;
What operators is needed to unset, for example, Bold? In the MSDN documentation they they have a Match() method. How does one use that?
Thanking all in advance
Cheers
READ MSDN
|
|
|
|
|
Since you are using powers of 2, the OR instruction is just like an ADD instruction. Therefore can't you just subtract?
I don't know how to make it display combinations... perhaps overriding ToString()?
Later,
Nathan
---------------------------
Hmmm... what's a signature?
|
|
|
|
|
Thx, thats exactly what i have now ended up doing, though it requires casting all members to int and then do the add, then cast back to enum type. Seems a bit like defeating the point thought The only thin that seems to work like I want it to is checking whether a flag is active by:
if ((format & StringFormat.Bold) == 0) etc...
to test for example if Bold is active.
Or maybe I'm just missing the point completely
Thx anyways
READ MSDN
|
|
|
|
|
Subtracting works, however it is nasty and generally not the way that you want to unset a flag. If you know that the Bold flag is set then you can use this to get rid of it.
<br />
format = format ^ StringFormat.Bold<br />
Note that this will toggle the Bold flag not erase it. So if it is set then it will unset it.
Jared
jparsons@jparsons.org
www.prism.gatech.edu/~gte477n
|
|
|
|
|
Thx
jparsons wrote:
Note that this will toggle the Bold flag not erase it. So if it is set then it will unset it.
So if Bold is set "^" will unset it , and if Bold is unset "^" will set it?
READ MSDN
|
|
|
|
|
|
You can unset by doing:
format = format & (0xFFFFFFFF ^ StringFormat.Bold);
The second expression gives you a vector with every bit set except the bold one, and then when you and that with format, you're assured that it's cleared.
If you have [Flags] on the enum, when you call ToString() on it, you'll get a comma-separated list of the set bits.
|
|
|
|
|
thx all , at least i can progress on one area. Just to recap.
to unset: format = format & (0xFFFFFFFF ^ StringFormat.Bold);
to set: format = format | StringFormat.Bold;
Thanx again all
Now if only that damned richtextbox will start behaving
READ MSDN
|
|
|
|
|
Hi all,
I encounter 2 following issues with PropertyGird:
1. Adding a NumericUpDown control into a PropertyGrid.
2. I cannot show a property which is not a enumeration type under a ComboBox in PropertyGrid.
Please help me to solve these issues. Thanks.
|
|
|
|
|
Vu Truong wrote:
I cannot show a property which is not a enumeration type under a ComboBox in PropertyGrid.
You will need to implement a TypeConverter for your property.
Sorry I cant help you with Q1.
READ MSDN
|
|
|
|
|
How can I determine the handle of a radio box or a button on a webpage? When I tried using Spy++ it only gave me the handle of the page area and this class: 'Internet Explorer_Server'. Can anyone help?
|
|
|
|
|
All of the HTML input controls with the exception of SELECT are Windowless. You cannot use regular Win32 techniques to play with them. Rather you have to use MSHTML.
|
|
|
|
|
How do I use MSHTML?
-Neophit-
|
|
|
|
|
If you're really good with COM a quick search of MSDN for MSHTML will bring up all you need to get started. If you aren't all is not lost. You can achieve ~90% of anything you need to do with scripting.
If you explain what you're goal is i might be able to come up with a plan for achieving it.
|
|
|
|
|
I have two classes, let's call them MyClassA and MyClassB. The former extends a form and contains a listbox, the latter is more of a data class, containing an ArrayList.
As you've probably guessed by now, I want to fill my listbox in MyClassA with the contents of the array list in MyClassB. The array list contains regular strings.
In the constructor in MyClassA I've got:
public MyClassA
{
InitializeComponents();
myClassB = new myClassB();
myListBox.DataSource = myClassB.myArrayList;
}
Unfortunately this does not work and I can't figure out why.
My next step was to try the same thing using an array list in MyClassA as data source. This works fine and the listbox is updated whenever the array list is.
Could anyone please tell me what I've missed? Are there any special considerations to make when using another class' member as data source? Do I have to use events or such?
Thanks in advance for any help!
|
|
|
|