![]() |
|
[.NET] Some useful code snippets - Printable Version +- Hack Forums (https://hackforums.net) +-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444) +--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151) +---- Forum: Software Development (https://hackforums.net/forumdisplay.php?fid=118) +---- Thread: [.NET] Some useful code snippets (/showthread.php?tid=4529199) |
Some useful code snippets - Dangerous Beef - Nov 9, 2014 Just wanted to share some of the code I'm using on the project I'm working on with you guys because I'm that nice. A better random system(Love this). Code Dim objRandom As New System.Random( _Code GetRandomNumber(MinVal, MaxVal) 'See Reference #1Get the average between 2 numbers. Code Public Function GetAverage(ByVal val1 As Integer, val2 As Integer)Code GetAverage(Val1, Val2)Log system, Requires a Rich text box control. (Useful for debugging.) Code Public Sub AddToLog(ByVal TextToInput As String)Code AddToLog("Hello World")Get percentage between 2 numbers. Code 'Calculate Percent of the MinVal and the MaxValCode GetPercent(MinVal, MaxVal)Might add some more if wanted. * - SIM-1847363 - Nov 9, 2014 I like the random system the most, but the rest is still good. |