10 Reusable Code Snippet Topics
Remove Filter
|
|
[B]Expression evaluation using Emit[/B] This class was designed to evaluate simple mathematical expressions. But instead of developing a routine to do the calculating, we use Emit to dynamically build a method that does the math for us. IMPORTANT: This is done with integer math. 7/2*3 = 9, not 10.5 (or … |
|
This is easy! But I admit, it can be rather confusing at first if you also take the old style MenuItem stuff into account. I hope my code is as clear as possible. If not please let me know. To test it, just start a forms application and paste it … |
|
Inheritance with generic types can sometimes be tricky. If you would inherit from a Stack<double>, no problem, but what if you want to keep it as generic as possible? Maybe it's a bad idea, but I wrote something like `class Stacker<T> : Stack<T>` and in Stacker I implemented some arithmetic … |
|
The purpose of this class is to be able to create an html form with ease. This is inspired by the form helper in CodeIgniter. This can easily adapt to bootstrap or any css and jquery where id is required. To use this class, we need to include the class … |
|
Hi, I thought I'd share this with you. If you want all fields on a web form to be emptied of ther initial value (if any) on focus and filled again with the initial value on blur. Works with jquery. |
|
Here is a small--complete--program that includes a sub-routine that inputs two matrices and then multiplies them. Notes: * 1) I happen to like taking input from a text file. It eliminates the need to type input from the console, especially when debugging, it prevents the possibility of making typos. * … |
|
After seeing quite a few posts today asking about event handlers for dynamicly created controls, I have decided to give a little example for reference. **Note that you should check [Microsoft's Documentation](http://msdn.microsoft.com/en-us/library/system.windows.forms.control.aspx#inheritanceContinued) ( or research from web ) of any control if you are struggling** |
|
This code demonstrates how to add controls to a form at run time. The number of rows and columns, the spacing between the controls and the size of the controls are all determined by Consts, but this could easily be changed so that the parameters are user entered. My example … |
|
There are many places on internet for great help regarding many things. Proper implementation of really fast routines for sorting data however is not common. I am not claiming these routines to be the fastest around, but their ease of implementation and use may make them welcome. As a thank … |
|
This program asks for integers from the user and stores them into a multidimensional array that adjusts its size. |
The End.