|
<Folder name="Main">
<file>Filename</file>
<file>Filename2</file>
<Folder name="SubFolderOne">
<file>Filename1</file>
<file>Filename2</file>
<file>Filename3</file>
</Folder>
</Folder>
There are XML commands to navigate up and down child nodes.
Not sure how you plan to bind hierarchical data to a DataGrid or DataList. I would imagine you are only referring to a sinlge level at a time.
The collections are based on "object". This can be anything. You can have a collections of collections this building your hierarchical data. An SortedList of SortedLists or ArrayList of ArrayList might work for you. This would mean that each Node was a new Collection.
There is an example of something along that lines at:
http://www.dotnetjunkies.com/tutorials.aspx?tutorialid=560[^]
If you need more than just a file name stored you can build your own class for a data item and use it in your collection instead of just a string.
Rocky Moore <><
|
|
|
|
|
I'm making web based application for file/folder management, and I need to keep a hierarchical structure of folders in memory all the time. Is there some kind of class that supports this "tree-like" organization, or do I have make my own implementation.
For instance, there's no Tree collection class? I do see a BinarySeach() method for the ArrayList class, but I dont see any BinaryTree class.
Anyone have any suggestions for how to keep track of a list of folders and their subfolders. The hierarchy must be dynamic and support adding, modifying, removing folder items at runtime. I really cant use a Binary tree structure because a folder can have many subfolders, not just 2 max.
Thanks.
|
|
|
|
|
To do this, you need to create 2 classes:
TreeItem - this hosts your private and public properties such as Path, as well as a TreeItemCollection
TreeItemCollection - inheriting this from CollectionBase will give you the easiest coding path. In this class you will need to implement standard collection methods such as Add, Insert, Remove, IndexOf etc.
|
|
|
|
|
Any ideas how I can display a listbox outside the confinds of a form without placing it on it's own form?
Thanks
Steve Graham
|
|
|
|
|
I don't think taht you can.
Just create a new form, tuen off the border and caption, then set the listbox to the same size as the form.
Paul Watson wrote:
"At the end of the day it is what you produce that counts, not how many doctorates you have on the wall."
George Carlin wrote:
"Don't sweat the petty things, and don't pet the sweaty things."
|
|
|
|
|
Are there any samples how to use IrDAClient ?
The MSDN doc is very bad for this class (no samples)!
Daniel
---------------------------
Never change a running system!
|
|
|
|
|
How can I convert the Graphics object back to a bitmap? I see alot of stuff for one way conversion, but no way to send it back.
Graphics n = Graphics.FromImage(Image.FromHbitmap(tempBitmap.GetHbitmap()));<br />
n.DrawLine(new Pen(new SolidBrush(Color.Beige)),StartPoint,EndPoint);
|
|
|
|
|
I think I'm going to feel a little stupid if the I am correct. But does the above code actually draw on the image.
|
|
|
|
|
|
I wanna ask the same question badly.
if you do:
Graphics n = Graphics.FromImage(tempBitmap);<br />
n.DrawLine(pen,StartPoint,EndPoint);
this will change the tempBitmap;
However,
if you do:
Graphics n = Graphics.FromImage(tempBitmap);<br />
Graphics h=pictureBox.creategraphics();<br />
h.DrawLine(pen,StartPoint,EndPoint);
n=h;
this doesn't seem change tempBitmap.
May some one explain this?
in one word, how do I save everything in the current pictureBox[something are drawn by graphics] into a bmp?
|
|
|
|
|
Think of the Graphics object as being a paint brush, and a Bitmap as being a canvas.
In your 2nd code example, you created a paint brush called "n" but did absolutely nothing with it. You then created a paint brush called "h" but incorrectly set it's canvas to be a PictureBox object - keeping with the anologies, the PictureBox object would be the frame, the actual canvas would be PictureBox.Image.
The basic fix for your code would be:
Graphics n = Graphics.FromImage(tempBitmap);<br />
n.DrawLine(pen,StartPoint,EndPoint);<br />
pictureBox.Image = tempBitmap;
Hope this helps..
|
|
|
|
|
I Get the Following error inside the "Windows form
designer generated code" section for the imagelist that
I've set up for a treeview:
An unhandled exception of
type 'System.Resources.MissingManifestResourceException'
occurred in mscorlib.dll
Additional information: Could not find any resources
appropriate for the specified culture (or the neutral
culture) in the given assembly. Make
sure "ServerComboBoxForm.resources" was correctly
embedded or linked into assembly "ServerComboBox_Test".
baseName: ServerComboBoxForm locationInfo:
NetworkManagement.Demo.ServerComboBoxForm resource file
name: ServerComboBoxForm.resources assembly:
ServerComboBox_Test, Version=1.0.1140.19047,
Culture=neutral, PublicKeyToken=null
Error occurs on this line of the InitializeComponent method:
this.imageList1.ImageStream =
((System.Windows.Forms.ImageListStreamer)
(resources.GetObject("imageList1.ImageStream")));
Can anyone tell me what the problem might be?
thanks.
.
|
|
|
|
|
If you're using a manifest file to make Visual Studio .NET display the XP visual styles, you'll need to create a manifest file for your application too. I got this non-sense error message some days ago, and learned that if you use a manifest file in VS.NET, then build a project, you'll need a manifest file to run the application...
Hope it helps.
John
|
|
|
|
|
John,
thank for the reply... not sure if I'm using a manifest file or not, how do I tell..??? I can add image lists to similar projects without a problem... I find it strange that the error occurs in Windows generated code...
How do I go about creating a manifest file?
|
|
|
|
|
I have had this same problem with VS.NET many, many times - for me it happens when I add my own class *before* a VS.Net generated class; e.g. You derive from the TreeView, but add your own TreeViewItem class in the same code page before the TreeView code. The workaround is to keep the VS.Net class as the first class. Don't know if this is the same problem you're having, but the symptoms are certainly the same.
|
|
|
|
|
Furty,
thanks for the reply... this doesn't seem to be the case for me... the "code page" as you call it, contains only the form class definition, and everything is generated by Windows... the subclased treeview class lives in a different sourcefile, and is only referred to when I instantiate a new treeview item in the form class...
any more suggestions are welcome
|
|
|
|
|
ever figure this one out? im getting the same issue with an imagelist for a toolbar.. dont the problem until i add an image to the imagelist.. exact same error..
still a newb.. cut me some slack :P
-dz
|
|
|
|
|
Look at the reply from "furty" above, this was my problem... I had declared something before the windows generated class, and the problem went away when I moved it further down in the source file...
hope this helps...
|
|
|
|
|
i ended up just making another form and using it.. as for saying you 'had declared something before..' do you mean where you declare your variables at the top of the class (where it generates all the textbox variables, etc.) or do you mean in the initializecomponent() section?
thanks! hopefully i wont run into this problem again..
still a newb.. cut me some slack :P
-dz
|
|
|
|
|
yes, I had added some declarations between the namespace declaration and the windows-generated form class declaration... once I moved those out, the problem went away...
|
|
|
|
|
double x, y, z;<br />
x = 41.3;<br />
y = 41.2;<br />
z = x - y;
If I perform the above operations, z should equal 0.1. Right??
But NO... .NET says that 41.3 - 41.2 = 0.099999999999994316.
Am I just being too demanding expecting to be able to get a precision in the first decimal place?? Or am I missing something?
-Michael Bray
mbray@ctiusa.com
|
|
|
|
|
Math.Round
Math.Round(3.44, 1); //Returns 3.4.
Math.Round(3.45, 1); //Returns 3.4.
Math.Round(3.46, 1); //Returns 3.5.
MyDUMeter: a .NET DUMeter clone "Thats like saying "hahahaha he doesnt know the difference between a cyberneticradioactivenuclothermolopticdimswitch and a biocontainingspherogramotron", but with words you have really never heard of."
|
|
|
|
|
OK, but tell me why I should have to do this?? What if I don't know the precision to expect, such as in the code that follows... What could I possibly put in the GetDifference(...) function that would know what level of rounding to perform? I'd have to iterate over several different rouding precisions, and that is just stupid.
<br />
public double GetDifference(double x, double y)<br />
{<br />
return x - y;<br />
}<br />
<br />
GetDifference(41.3, 41.2);<br />
GetDifference(41.33, 41.32);<br />
GetDifference(41.333, 41.332);<br />
-Michael Bray
mbray@ctiusa.com
|
|
|
|
|
fuzzylintman wrote:
OK, but tell me why I should have to do this??
Because double is much less accurate than a decimal. Have you tried using decimals instead? Is this monetary? Use a lower denominator (e.g. in penny value). There was a long discussion on this a few days back.
MyDUMeter: a .NET DUMeter clone "Thats like saying "hahahaha he doesnt know the difference between a cyberneticradioactivenuclothermolopticdimswitch and a biocontainingspherogramotron", but with words you have really never heard of."
|
|
|
|
|