Erik Westermann wrote: Simply becasue the idea of the .NET Platofrm is to provide a space where all activities occur in a managed, type-safe environment. The System namespace is called "system" becuase it exposes classes that you can use to interact with the "system". If your applicaiton throws an exception, throw an applicaiton-specific exception that's derived from System.ApplicationException to avoid confusion with CLR-generated exceptions.
But wouldn't this be a problem in itself? Let's say you write a program, that uses class libraries from two or three different vendors and each throws a different kind of exception if the exact same condition (an argument is set to null for example) is met? Wouldn't this be a bad design, too? And why is it more exceptional if you pass an invalid "null" argument to a clr function than to a function of a third party library? I see the point with the out of memory exception - that sure is some kind of "system exception". But ArgumentNullException and ArgumentOutOfRange exception? Actually I never thought about these problems (Visual C# step by step at least uses these two exceptions in user code) - only wether it is the right exception to be thrown from a set accessor.
Martin Häsemeyer wrote: Wouldn't this be a bad design, too?
How so? You know the exact nature of the problem based on the exception's type. Besides, all exceptions are derivatives of System.Exception; as a result, if you code your catch blocks properly, you'll be able to handle errors from both libraries in this scenario.
Martin Häsemeyer wrote: And why is it more exceptional if you pass an invalid "null" argument to a clr function than to a function of a third party library?
It isn't. It depands on what the class' designer is atembpting to achieve. An exception is designed to, ultimately, halt your code if it is allowed to 'bubble up' through to the system regardless of what type of exception gets thrown. Exceptons are non-local control structures that let you centralize error handling in one part of your application as opposed to having you sprinkle if statements throughout your code. In some cases; however, it is more approprate a number of cases to use a less computationally expensive means of handling an error.
Erik Westermann
Author, Learn XML In A Weekend (October 2002)
Erik Westermann wrote: Exceptions are for exceptional conditions - conditions that are unexpected during normal circumstances. Exceptions are relatively expensive and aren't that great for stuff like this.
I was just watching the latest .Net show off MSDN and it is all about performance. One of the things they where saying is Exceptions are only expensive if you acctually throw the exception. This makes them very good for doing this sort of thing.
I want to lighten/darken the shade of a given color. I just wondered if there was a better way, than just adding/substracting an amout from each RGB value, because it in some cases, the difference in color is minute.
MS quote (http://www.microsoft.com/ddk) : As of September 30, 2002, the Microsoft® Windows® 2000 DDK, the Microsoft Windows 98 DDK, and the Microsoft Windows NT® 4.0 DDK will no longer be available for purchase or download on this site. Support for development will ship at the same time as the Windows XP Service Pack 1 (SP1) release.
MS quote (http://www.microsoft.com/ddk) : As of September 30, 2002, the Microsoft® Windows® 2000 DDK, the Microsoft Windows 98 DDK, and the Microsoft Windows NT® 4.0 DDK will no longer be available for purchase or download on this site. Support for development will ship at the same time as the Windows XP Service Pack 1 (SP1) release.
I'm sure you can use bits of it but I'm not sure why you'd want to. You certainly can't (ar at the very least shouldn't) display a Windows Forms control on a web page.
I'm working on a small app that scrapes some HTML and parses out a few data items.
(specifically: I am trying to snag the 2 values for Total CPU Time (4:217:02:06:36) and Ranking (# 2,313) contined in the sniped below)
<br />
<tr bgcolor="#FFFFFF" onmouseover="javascript:style.background='#E5E5E5'" onmouseout="javascript:style.background='#FFFFFF'"><br />
<td>Total CPU Time (y:d:h:m:s) (Rank)</td><br />
<td nowrap="true">4:217:02:06:36(# 2,313)</td><br />
</tr><br />
Any suggestions on HOW? I am assuming that a RegExp might be the easiest, but I'm no wizard at creating those (i.e. any suggestions/help would be appreciated).
I want to make an automatic update system. Here is my simple plan for one:
At the begining of application init, the application will go into the updater block.
//////// Updater block psedo code
settings = Load application settings;
if (user wants auto updates)
{
//creat an instance of the updater from a library Updater.dll
Updater myUpdater = new Updater();
// updater goes online and check for updates
UpdaterFeedback = myUpdater.StartUpdater();
if (updaterfeedback == updatefound)
{
if (settings.totallyautomatic == true)
{
updater.doupdater
}
else
{
// ask user if they want to update & tell them about the update
// also give them some info on it
if (userWantsToUpdate == true)
{
updater.DoUpdate();
}
}
}
}
else
{
continue with the application startup
}
//////// End updater block
----------------------------
If you have any ideas, please post them
I have not a clue how to do the internet update check, if you have any ideas please post them.
well you could use the WebRequest classes to read a txt file from the net that has the latest version number for the app, and if not, downmload the new file. i cannot offer any more help on the matter, and next time, try thinking about it, istead of asking someone to write it for you, if you get stuck on a particular aspect of it, then we'll be more than happy to help.
Can some please explain how the "auto" paging option of the DataGrid web control is meant to work?
My datasource is a class derived from CollectionBase. Now the first page shows up fine, but when I click any other page number, nothing happens, the page does not display anything but the first page. The event gets fired as well, but that seems only of use when you want to do custom paging.
You still need to handle the event, even when it's automatic. All you actually need to do in that event handler is: DataGrid1.CurrentPageIndex = e.NewPageIndex but having to handle it yourself gives you the control to do other things.
For example, if you had an EditCommand column in the datagrid and someone hits edit on the fourth row, then pages to the next page, the EditItemIndex is still going to be set to 4, so you need to set it back to -1 in the PageIndexChanged event.