|
Stefan Troschütz wrote:
Can't say if they are helpful because i never used them myself.
Same here, I too damn scared they break my 31337 code
top secret xacc-ide 0.0.1
|
|
|
|
|
hello,
i would like to know if there's a method in C# that can copy a hole directory with its files and subdirectories.
thanks
|
|
|
|
|
I don't believe there is; the framework is a little more modular than that: you can use File.Copy to copy a file or Directory.CreateDirectory to make a duplicate directory. From there, just call File.Copy on each file returned from Directory.GetFiles() and call Directory.CreateDirectory on each sub directory, then do this recursively for each folder.
#include "witty_sig.h"
|
|
|
|
|
|
my way to do it
private void cmdCopy_Click(object sender, System.EventArgs e)
{
if(!Directory.Exists(txtDist.Text))
{
MessageBox.Show("Please enter a valid path");
return;
}
DirectoryInfo dir=new DirectoryInfo(txtSrc.Text);
CopyDirectory(txtSrc.Text,txtDist.Text+"\\"+dir.Name);
MessageBox.Show("OK");
}
private void CopyDirectory(string src,string dist)
{
if(!Directory.Exists(dist))
Directory.CreateDirectory(dist);
FileInfo file;
DirectoryInfo dir;
string[] strFiles;
string[] strDirs;
strFiles=Directory.GetFiles(src);
foreach (string strFile in strFiles)
{
file=new FileInfo(strFile);
file.CopyTo(dist+"\\"+file.Name);
}
strDirs=Directory.GetDirectories(src);
foreach (string strDir in strDirs)
{
dir=new DirectoryInfo(strDir);
if(dir.FullName==dist)
continue;
CopyDirectory(dir.FullName,dist+"\\"+dir.Name);
}
}
|
|
|
|
|
Hello,
Why won't this work?
ds.ReadXml(filePath);
dtgAppserver.DataSource = ds;
dtgAppserver.DataMember = "appserver";
the xml-file looks like this:
<session name="dfghjgfd">
<appservers>
<appserver name="">
<appservice></appservice>
<autoconnect>false</autoconnect>
</appserver>
</appservers>
</session>
The compiler says:
An unhandled exception of type 'System.ArgumentException' occurred in system.windows.forms.dll
Additional information: Cannot create a child list for field appserver.
what can i do about this?
thx an advance
|
|
|
|
|
Not any XML document can be read into a DataSet . 2- and 3-tier schemas can, and attributes on the "table" tier act as fields along with any child elements. This schema will not work in a DataSet . See XML and the DataSet[^] in the .NET Framework SDK for more information.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Hi,
As i have not a lot of experience with object oriented programming and design pattern, I'm here to ask for help.
This is the problem i have to resolve.
I have a database in which are stored both the structure and the content of a web application.
The structure is expressed in term of HDM methodology, i.e. a page is made up of "Entity" (data of interest to the user) or "Collection" (organised set of information object). An Entity is organised in semantic sub-units called "Components", which are pure organisational device for grouping the contents of an entity into meaningful chunks. Components can further be decomposed in sub-component, but the actual content can be associated with leaf components only. The contents of leaf components is defined in terms of "Slot" - attributes that define the primitive information elements.
A "Semantic association" connects two entities - creating an infrastructure for a possible navigation path - and has a local information object called "Association Center" which contains data that define and specify the association itself and provide additional information on how to represent both the single target elements, in a concise way, and the whole group of target elements that relate to the same source.
Collections also provides the user with a way to explore the information contents of the application- they give a preview of the target element expressed as a set of "Slot" called "Segment".
The only pattern i have identified is the Composite, but i'm sure there is more.
Moreover in the future this system have to deal with multiple user (but this is not my problem, at the moment).
Thank you, bye.
|
|
|
|
|
So what's your question?
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
I forgot to say that when navigate through a "Collection" o "Semantic association" the same "Entity" instance can be accessed by different way - i can find the book "It" under the "King book" collection or under the "Horror book" collection and in both case the next(previous) instance depend on the structure i navigate.
Stated that,the main question is:
1) which design pattern can i use to manage this navigational mechanism?
and also :
which class diagram better illustrate the entire problem?
thank you
|
|
|
|
|
I got a pictureBox and I put an image on it.
please show me how to print that image.
Thanks
Rock Throught The Night
|
|
|
|
|
|
Hai,
I am new to C#, Can any one find a solution for my problem. I created an webservice and itz working fine in my localhost but getting error when uploaded in to my webserver, I am getting an error like
Server "\" App
please give me a solution
Thanks in Advance
VV
|
|
|
|
|
Nice double post. You'll probably be waiting a long time for this one.
Vinod2508 wrote:
please give me a solution
This is very cocky!
Yes, I program in VB6, but only because I use it to fill my addiction to having a dry place to sleep and food to eat!
|
|
|
|
|
Hai,
I am new to C#, Can any one find a solution for my problem. I created an webservice and itz working fine in my localhost but getting error when uploaded in to my webserver, I am getting an error like
Server "\" App
please give me a solution
Thanks in Advance
VV
|
|
|
|
|
Be more specific. What is the entire exception type and message? Typically, when you move a web application and get errors, it's either because some dependent assembly isn't located on the server (or at least where you think it is) or because you hard-coded paths and they aren't the same. With the actual exception text, it's impossible to say.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Thankz for your reply
Can u please tell me the step to host an web service
I have created an web application on local host and it is working fine on my localhost. When I uploaded it in to my remote host it gave me error. what I have done is that
Copied my application directory in to a virtual directory on host which have .net support.
Waiting for Your Valuable reply
Thanks in advance
|
|
|
|
|
That virtual directory should be an application. In the IIS configuration manager, right-click on the directory and click the button to create a new application. If you don't, the Web.config from the root will apply and your Web.config can only override a couple sections (like <authorization> ). Since you still haven't told me the exact error (and if you don't see it, follow the directions about turning custom errors off), I can't tell you what's wrong.
If you need to know more, read the Visual Studio .NET documentation that explains all this. It's important to understand what you're doing.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Thankz for your reply
Can u please tell me the steps to host an web service
I have created an web application on local host and it is working fine on my localhost. When I uploaded it in to my remote host it gave me error. what I have done is that
Copied my application directory in to a virtual directory on host which have .net support.
Waiting for Your Valuable reply
Thanks in advance
|
|
|
|
|
I've always tought that when you create a new Item, you should always dispose it when you are finished with it, but when I create a:
Random rand = new Random();
The option to do rand.Dispose() does not exist.
Why is this? And what is the rule on disposeing?
Thanks
Thomas
|
|
|
|
|
Dispose generally exists to clean up unmanaged objects, the garbage collector deals with fully managed objects.
|
|
|
|
|
IMHO, System.Runtime.InteropServices.Marshal.ReleaseComObject(object o) is a better way to "tidy up" unmanaged objects in the pool...
Jeremy Kimball
I have traveled the gutters, lo these many days, with no signs of life. Well met.
-brianwelsch
|
|
|
|
|
not all objects of all class types need to be disposed.
only objects that should releasr some resources like open files , DB/Network connections, Handles.
this soes not apply to Random class.
|
|
|
|
|
Search the documentation for Finalization, Garbage Collection and Disposing. There are plenty of infos on this topic.
Also you could read this article[^] of MSDN magazine.
www.troschuetz.de
|
|
|
|
|
I just read a good debate over some uses of IDisposable interface over at Ian Griffith's blog[^] that you might find interesting.
#include "witty_sig.h"
|
|
|
|