Here is a gift to .Net Application Programmers: A huge collection of useful .Net functions which you will find useful and interesting in your daily .Net programming. The project is written in C#.Net, and still being updated. Let me know if you have any question or suggestions, I would be glad to help you.
Here are the usage guide-lines for some important classes and functions of the library:
1. DataMethods Class
DataMethods class provides all core functionality for SQL database.
Only once, you just need to provide the database connection string at the start up of your application.
Or if you are using configuration file (App.config or Web.config):
Some of the important functions form this class:
- GetDataSet
- GetDataTable
- GetDataRow
- GetScalar
- GetCount
- ExecuteQuery: Execute non-query types like Insert, Update or Delete.
- SearchEntireDatabase: Search for a string in all tables of the database
You can also use SQL transaction very easily with this class: Just call your all queries after calling BeginTrans: Use RollBackTrans to cancel (undo) the transaction and use CommitTrans at last on success.
DataMethods class is used for all database related operations by other classes of the library too- like DataExporter class.
2. StringMethods Class
All methods related to string which you are missing in C#.Net.
- IsNumeric: Check if the provided text is a numeric value or not
- Split
- IsStringEmpty: Check if the string is null or empty with trimming spaces
- GenerateRandomString
- GetRandomNumber
- ToSentenceCase: Convert the text to proper sentence case
- ChopText
- ReplicateString
- NumberToWords: Convert a numeric value into word format.
3. FileHandling Class
Offers functions related to writing in files and getting file information. Important functions:
- GetFileName: Get a file name from the full path
- GetDirectoryPath: Get directory path of the file
- IsDirectory: Check if the given path is a directory or a file
- CopyFiles: Copy or move files from given sources to the destination
4. MediaPlayer Class
Easily play background sound using methods of this class. Offers Play, Pause, Stop and functions to control volume, treble and bass.
bool Loop = true;
objPlayer.Play(“D:\Media\Sounds\Tone1.mp3”, Loop);
5. Calculator Class
Provide any simple or complex input formula and this class will evaluate it and give you the result. The function automatically handles parenthesis.
6. DataExporter Class
Export data from your data table or from SQL Select query to a file in formats like plain text, HTML and CSV (Excel).
objExporter.DataTable = dt1;
objExporter.TableTitle = “Daily Report”;
objExporter.ExportHTML(“D:\Reports\Report1.html”);
objExporter.ExportPlainText(“D:\Reports\Report1.txt”);
objExporter.ExportCSVFormat(“D:\Reports\Report1.csv”, “,”);
7. DateDifference Class
Easily find difference between two dates in year, month and days.
string difference = objDateDiff.ToString();
8. DateTimeMethods Class
Functions related to date-time like convert a string to usable date, get month number from month name or month short-name, convert a date into word format.
- ConvertToSystemDate (“09/28/1982”, “M/d/yyyy”)
- GetMonthNumberFromMonthName (“JAN”)
- GetDateInWords
9. HTMLUtil Class
Easily generate HTML formatted text and save to a file. You can provide a DataTable and automatically convert it into HTML format.
objHTML.FilePath = Application.StartupPath + “\\” + “Contacts.html”;
objHTML.AddText(“Contacts”, “bold”, null, “underline”, null, null, null, HTMLUtil.Align.Center);
objHTML.AddTable(dtContacts, “Name|Phone1|Phone2”, “Name|Phone 1|Phone 2”, “200px|100px|100px”);
objHTML.Print();
10. Networking Class
Useful networking related methods like check if a website is running or down, check if internet connection is available or not.
- CheckInternetConnection (“https://techforworld.com”)
Conclusion
You may download the TechForWorld .Net Library here. The source code of the library is available on limited basis, contact/email us for it.
Rahul Kumar says
Very impressive language and words are used on the page. This is the best way of representing a topic. Easy language and words are used+they are very easy to understand. I will share this website and information given in it.
Rsdj says
I will post such article on my blog also and will link your article as reference. By the way… thanks for the good words.
Kadian says
search a lot about this topic.Finally found on your website. thanks for sharing buddy……..
keep updating
John says
Rahul you are saying exactly write.
Tom Suzzy says
Very informative and useful… Thanks for sharing… Following you now