Advertisement

Results for "Author: jon davis"

4_2005-2006 #164765
Get Embedded Resource

If you want to drop a text file, an XML file, an icon, or a bitmap, or any other file, into your project directory and have it embedded with your solution, this will make it much easier to retrieve these resources. For instance, if you drop a file called "MainMenu.xml" into a project subdirectory called "Resources" (or, "[project directory]\Resources\MainMenu.xml") and you've marked it as an Embedded Resource, you can retrieve it programmatically like so: XmlDocument mainMenu = (XmlDocument)App.GetEmbeddedResource("Resources/MainMenu.xml");

4_2005-2006 #164766
The Return of the Variant (ver. 6)

A Variant structure written in C#, ideal for VB.NET 2005 or C# 2002/2003/2005 developers who miss the old (and, in the eyes of many, ugly) VB6 Variant. A Variant is a type that contains any type of variable and can be worked with "automagically" without heavy typecasting procedures. (System.Object is not a variant equivalent because you cannot do things like addition with it.) One important difference about this structure: It becomes what you do to it. So if the value is a string and you add an integer of 12, the value becomes an integer. If you want it to remain the same, you should typecast first--for example, add "12" rather than (int)12. Changes for v2: - All type properties ("String", etc.) are now private. - Added implicit/explicit custom operators, so typecasts now work naturally. For example: string myString = (string)myVariant; // no longer myVariant.String ... float myFloat = (float)myVariant; // no longer myVariant.Float ... bool myBool = (bool)myVariant; // no longer myVariant.Boolean .... Changes for v3: Quite a few. Added DateTime support. Implemented IConvertible. Changed all the private type name properties to public "To[type]()" methods. Changed the naming convention to conform to IConvertible. Changes to v3.1: Removed many unnecessary if statements. Made some documentation updates. Changes to v4: Removed the "Type becomes what you do with it" rule for numeric operations. Example: adding an integer of 1 to a float of 1.1 results in a float of 2.1 rather than an integer of 2. Changed operator overloads to automatically adjust the type if the operation causes the resulting value to extend numerically beyond the value of the type. For example, if an integer (Int32) operation results in a value than can fit into an integer, the value is changed to a long (Int64). Changes to v5: Changed operator overloads so that if auto-converting to a compatible type, the new type is not smaller than the previous type; Made changes to CBln() to default to True if the object is a non-empty string; Added lots of documentation. Change to v5.1... it's IsNumberable, not IsNumerable. :) Also, To[Type]() should default to the specified type. And SmartMath() method name changed to VariantArithmetic(). Changes in v6... Added TimeSpan type support; added IsDate, IsTimeSpan; updated operator overloads, including equality (==).

4_2005-2006 #164767
Guess A Number game

This is a simple demonstration of a simple console application written in C#.

4_2005-2006 #164768
HTM2ASP Redirector (easy .htm/.html to .asp redirector)

Have you ever needed to switch the file extension of a large set of files from .htm to .asp but you were worried about other web sites linking to the .htm files? You could create a new redirector .htm file for every file you switch to .asp. Or, you can just download and set up this solution! Just drop this file somewhere on the web server (remember the URL), and then configure the Custom Errors settings in IIS (by default pointing to 404b.htm) to point to this file's URL. That's it!

4_2005-2006 #164769
Code Stringifier

It's a common problem everyone has faced. You have a couple paragraphs of text that you want to store in a constant. But how do you manage quotation marks, line breaks, and backslashes in a quoted string? This solution will let you paste text into a textbox, and it will spit out the source code in order to store that text properly in a variable. Outputs to Javascript, VBScript, VB6, VB.Net, C#, and HTML. Very handy!

4_2005-2006 #164770
DHTML Javascript Console

This is a demonstration of using dynamic content and event handling in Internet Explorer to input data from the user (as with a textbox, only without a textbox) and update the web page accordingly. The same method of keypress trappings and DHTML dynamic content can be applied in a far more graphical way, but the concept would be the same. In this particular demonstration, JavaScript commands are merely displayed in plain text. However, one could utilize graphics-based text in a graphics-intensive UI if he chose to. Requires Internet Explorer 5.0+. (Implemented in v6.0 though.)

4_2005-2006 #164771
Default functions and properties

Make a function or a property the default function or property for that object.

4_2005-2006 #164772
Cool Logic (Lots of simple but handy functions)

These are some functions that I use all the time that Microsoft left out of core VB. Some of them are more useful than others, like IsEven()/IsOdd() and IsLeapYear() and PlaySound() and SaveString() and GetPathDir(). Some of this source is borrowed and modified from other authors' sources, but at least half of it is original. I have rewritten this code to put it into a class module, and then I compiled it to a DLL. I use the DLL all the time in projects. Very handy!

4_2005-2006 #164773
CUri - A URL parser class

This is a URL parser class that accepts a URL (such as "http://www.blah.com/") and parses out: - the protocol - the hostname - the username - the password - the port - the resource - the querystring Enjoy!

5_2007-2008 #187282
Play sound in C# without DirectX

Why load DirectX to play a sound when you can just call the Windows library?

5_2007-2008 #187283
Get Embedded Resource

If you want to drop a text file, an XML file, an icon, or a bitmap, or any other file, into your project directory and have it embedded with your solution, this will make it much easier to retrieve these resources. For instance, if you drop a file called "MainMenu.xml" into a project subdirectory called "Resources" (or, "[project directory]\Resources\MainMenu.xml") and you've marked it as an Embedded Resource, you can retrieve it programmatically like so: XmlDocument mainMenu = (XmlDocument)App.GetEmbeddedResource("Resources/MainMenu.xml");

5_2007-2008 #187284
The Return of the Variant (ver. 6)

A Variant structure written in C#, ideal for VB.NET 2005 or C# 2002/2003/2005 developers who miss the old (and, in the eyes of many, ugly) VB6 Variant. A Variant is a type that contains any type of variable and can be worked with "automagically" without heavy typecasting procedures. (System.Object is not a variant equivalent because you cannot do things like addition with it.) One important difference about this structure: It becomes what you do to it. So if the value is a string and you add an integer of 12, the value becomes an integer. If you want it to remain the same, you should typecast first--for example, add "12" rather than (int)12. Changes for v2: - All type properties ("String", etc.) are now private. - Added implicit/explicit custom operators, so typecasts now work naturally. For example: string myString = (string)myVariant; // no longer myVariant.String ... float myFloat = (float)myVariant; // no longer myVariant.Float ... bool myBool = (bool)myVariant; // no longer myVariant.Boolean .... Changes for v3: Quite a few. Added DateTime support. Implemented IConvertible. Changed all the private type name properties to public "To[type]()" methods. Changed the naming convention to conform to IConvertible. Changes to v3.1: Removed many unnecessary if statements. Made some documentation updates. Changes to v4: Removed the "Type becomes what you do with it" rule for numeric operations. Example: adding an integer of 1 to a float of 1.1 results in a float of 2.1 rather than an integer of 2. Changed operator overloads to automatically adjust the type if the operation causes the resulting value to extend numerically beyond the value of the type. For example, if an integer (Int32) operation results in a value than can fit into an integer, the value is changed to a long (Int64). Changes to v5: Changed operator overloads so that if auto-converting to a compatible type, the new type is not smaller than the previous type; Made changes to CBln() to default to True if the object is a non-empty string; Added lots of documentation. Change to v5.1... it's IsNumberable, not IsNumerable. :) Also, To[Type]() should default to the specified type. And SmartMath() method name changed to VariantArithmetic(). Changes in v6... Added TimeSpan type support; added IsDate, IsTimeSpan; updated operator overloads, including equality (==).

5_2007-2008 #187285
Guess A Number game

This is a simple demonstration of a simple console application written in C#.

5_2007-2008 #187286
HTM2ASP Redirector (easy .htm/.html to .asp redirector)

Have you ever needed to switch the file extension of a large set of files from .htm to .asp but you were worried about other web sites linking to the .htm files? You could create a new redirector .htm file for every file you switch to .asp. Or, you can just download and set up this solution! Just drop this file somewhere on the web server (remember the URL), and then configure the Custom Errors settings in IIS (by default pointing to 404b.htm) to point to this file's URL. That's it!

5_2007-2008 #187287
Code Stringifier

It's a common problem everyone has faced. You have a couple paragraphs of text that you want to store in a constant. But how do you manage quotation marks, line breaks, and backslashes in a quoted string? This solution will let you paste text into a textbox, and it will spit out the source code in order to store that text properly in a variable. Outputs to Javascript, VBScript, VB6, VB.Net, C#, and HTML. Very handy!

5_2007-2008 #187288
DHTML Javascript Console

This is a demonstration of using dynamic content and event handling in Internet Explorer to input data from the user (as with a textbox, only without a textbox) and update the web page accordingly. The same method of keypress trappings and DHTML dynamic content can be applied in a far more graphical way, but the concept would be the same. In this particular demonstration, JavaScript commands are merely displayed in plain text. However, one could utilize graphics-based text in a graphics-intensive UI if he chose to. Requires Internet Explorer 5.0+. (Implemented in v6.0 though.)

5_2007-2008 #187289
Default functions and properties

Make a function or a property the default function or property for that object.

5_2007-2008 #187290
Cool Logic (Lots of simple but handy functions)

These are some functions that I use all the time that Microsoft left out of core VB. Some of them are more useful than others, like IsEven()/IsOdd() and IsLeapYear() and PlaySound() and SaveString() and GetPathDir(). Some of this source is borrowed and modified from other authors' sources, but at least half of it is original. I have rewritten this code to put it into a class module, and then I compiled it to a DLL. I use the DLL all the time in projects. Very handy!

5_2007-2008 #187291
CUri - A URL parser class

This is a URL parser class that accepts a URL (such as "http://www.blah.com/") and parses out: - the protocol - the hostname - the username - the password - the port - the resource - the querystring Enjoy!

6_2008-2009 #209800
Play sound in C# without DirectX

Why load DirectX to play a sound when you can just call the Windows library?

Languages
Top Categories
Global Discovery