|
try
{
throw new Exception("Clear Me!");
}
catch(Exception ex)
{
ex = null;
}
|
|
|
|
|
pekhaleyogesh wrote: clear Exception object in Catch?
Can you please explain your requirement clearly?
*jaans
|
|
|
|
|
Do u want to make it null
.....
|
|
|
|
|
Why would you want to do this? As soon as you leave the exception scope, it's cleared.
|
|
|
|
|
If you just want to mask the Exception, have an empty catch block. But that is really not a good idea, catch blocks should never be empty, especially if you catch the System.Exception object. At some point, it will come back and bite you in the ass.
|
|
|
|
|
I want to creat a new icon for my software in desktop and set location it in (x,y) . But I don't know how to do it.
Can u give some advise?
// Sorry about my poor english.
|
|
|
|
|
Do u want to create an icon for the desktop shortcut of your program? If so in your setup project under user's desktop tab create a short cut and provide the icon ( found in shortcut's properties)...
.....
|
|
|
|
|
uhm ... I see but :
+ In my desktop, I have a Icon ( Ex: my computer ). Now, I want to move this Icon to ( x,y ) ( or Anywhere in desktop ) what should i do ?
Thanks about ur answer.
|
|
|
|
|
hmm.. i think u can't do that ..I'm not sure abt it
.....
|
|
|
|
|
uhm ..
When u right-click mouse on desktop. Choose Arrange Icons By and choose type. U will see all of icon will sort and change location. So that i belive that It can be done. But ...
Who can help me ?
|
|
|
|
|
So you want to move the users icons? I don't think that is possible.
And like you said , you can 'Arrange Icons By...' which arragnes your icons, and if you have auto-arrange on, then you can't even move them properly yourself. Never mind with code.
My current favourite word is: Bacon!
-SK Genius
|
|
|
|
|
Ok ! We will discuss it by this ex:
" I have a icon ( ex: My Computer ). I move it to A(x,y). And I restart, when windows logon I see this icon in A(x,y). So I wonder why win know where it is. How do window save info of it ? I had tried to find it in registry but I didn't see"
Do u have any ideal ?
|
|
|
|
|
Hi,
I am new to C#.NET..
I am building a C# application which searches for files in the HDD..
However there may be many duplicate files with the same name and same contents..
My objective is to delete the files with same contents..
So, say if there are two files (mscorlib.dll for framework 1.1 and another mscorlib.dll for framework 2.0), the application should not delete them, since they are essentially two different assemblies for different framework and should have different contents in it..
Where as say we have a file (abc.exe and another: pqr.exe) having the same contents(say I copied one and renamed it to another), they should be deleted, since they contain same contents and differ in name only..
How do I apply this?
How can I know the contents of a file?
Do I have to apply some checksome algorithm for that? If so, How? If No, then how to find out whether the contents of two files are same??
Please keep in mind I am doing this only for executables (.exe,.dll,.bat,.com etc)
Please guide..
Any help would be greatly appreciated..
Thanks..
|
|
|
|
|
This sounds like a nightmare. If you do it across your HDD, I will bet money you break somethings.
File.ReadAllBytes will load the files, then you can compare them.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Christian Graus wrote: If you do it across your HDD, I will bet money you break somethings.
Didnt quite get this line.. What might break??
Christian Graus wrote: File.ReadAllBytes will load the files, then you can compare them.
How to compare them??
Any particular method in BCL or write an algorithm for that?
|
|
|
|
|
ptr2void wrote: Didnt quite get this line.. What might break??
If you let a process run wild on your machine which randomly decides to delete exe's dll's etc there is a fairly good chance you will break your windows install.
ptr2void wrote: How to compare them??
Any particular method in BCL or write an algorithm for that?
You compare them by comparing their bytes. Try some code, read any exe on your machine using File.ReadAllBytes . Have a look at the return from that method (a byte array) and have a think about how you might compare 2 separate file's bytes (hint: a byte is essentially a number between 0 and 255)
|
|
|
|
|
J4amieC wrote: If you let a process run wild on your machine which randomly decides to delete exe's dll's etc there is a fairly good chance you will break your windows install.
I think you didnt understand my question or maybe I didnt put in a comprehansible manner..
I dont want to delete the searched files on the HDD.. That would be horrible..
I just want to delete(omit) them from my search results !!
|
|
|
|
|
delete implies to remove. "omit from results" has a very different meaning.
|
|
|
|
|
The bolding had a profound effect as well.
"Run for your life from any man who tells you that money is evil. That sentence is the leper's bell of an approaching looter." --Ayn Rand
|
|
|
|
|
ptr2void wrote: Didnt quite get this line.. What might break??
Imagine that you installed two different applications that use the same control (e.g. Excellent.Grid.dll ). Your app will find the Excellent.Grid.dll file in two different directories (e.g. C:\Program Files\Excellent Calendar and C:\Program Files\Excellent Cookbook), will delete one copy since they are exactly the same and... one application will stop working.
|
|
|
|
|
You could get the MD5 hash of the file, of course this may take a while. I recomend against your course of action strongly because you may screw something up.
|
|
|
|
|
Hi,
I am using a FolderBrowserDialog to get the user to select a path. I then display the selected path in a text box using the FolderBrowserDialog.SelectedPath property. It works well with anything that's not a non-english version of Vista.
On an Italian version of Vista, for example, the FolderBrowserDialog will display the localized folders, where "Program Files" is "Programmi", etc.
The problem is, if the user selects "C:\Programmi" in the FolderBrowerDialog , when I display the selection in a textbox, it displays "C:\Program Files". From what I understand, the "real" name of "C:\Programmi" is "C:\Program Files" and "Programmi" is just a display name (new to Vista, in XP the display name and real name were both "C:\Programmi").
So my question is: How do I get the display name so that I can show it to the user instead of the real name? Is there a property in either Path or DirectoryInfo or Directory that would do the "Translation"?
Any help on this would be much appreciated!
Hugo Migneron
|
|
|
|
|
<!-- <?xml version="1.0" encoding="utf-8"?>
<BookMarkInfo>
<res>
<X>1.02</X>
<Y>6.58</Y>
<Z>3.26</Z>
</res>
<sirt>
<X1>5.02</X1>
<Y1>3.58</Y1>
<Z1>5.26</Z1>
</sirt>
</BookMarkInfo> -->
I need to parse the above XML file and store in Data structure.
Struct BookMarkInfo
{
double x,y,z;
String bkMrkName;
}StBk[10];
StBk[0].bkMarkName = res;
StBk[0].X=1.02;
StBk[0].Y=6.58;
StBk[0].Z=3.26;
StBk[1].bkMarkName = sirt;
How can I store it?
Thanks
Ash
|
|
|
|
|
I suspect you need to do some reading on XPath and the XML DOM.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
I have a small problem, I am writing an updater for my app. So, it finds the folder my exe is in, and it has a new copy of that exe amongst the files to copy in. I want to show the different version numbers for both exes. This is easy. However, loading the assembly means I can't copy over the file. I've had no luck in trying to load the assembly in another app domain. It doesn't work when then file is not in a subfolder of my exe.
System.AppDomain NewAppDomain = System.AppDomain.CreateDomain("NewApplicationDomain");
Assembly a = NewAppDomain.Load(AssemblyName.GetAssemblyName(Path.Combine(_path, "MyAppName.exe")));
GetAssemblyName gets a valid name, but the Load method cannot find it.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|