Difference between revisions of "Code samples"

From HashVB
Jump to: navigation, search
m (Reverted edit of ErdroNzele, changed back to last version by Dee)
 
(44 intermediate revisions by 15 users not shown)
Line 1: Line 1:
 +
<div style="float: right; margin-left: 10px;">__TOC__</div>
 
Below are a selection of VB code samples. Feel free to use any of them in your own projects.
 
Below are a selection of VB code samples. Feel free to use any of them in your own projects.
 +
 +
Please also feel free to make your own contributions of articles and/or article modifications.  The more articles we get the better this resource will be! :)
  
 
==COM objects==
 
==COM objects==
 
* [[Events from a module|Firing events in an object from a code module]]
 
* [[Events from a module|Firing events in an object from a code module]]
 
* [[Modularised Subclassing|Modularised Subclassing using interfaces and CopyMemory]]
 
* [[Modularised Subclassing|Modularised Subclassing using interfaces and CopyMemory]]
 +
* [[Modularised Subclassing The Same Object Twice|Modularised Subclassing (the same object twice) using interfaces and CopyMemory]]
 
* [[Singletons|Creating singleton objects]]
 
* [[Singletons|Creating singleton objects]]
 +
* [[Using For Next on your own class|How to make your classes support For/Next constructs]]
 +
* [[Streaming HTML content into a webbrowser control from VB|Streaming HTML into a webbrowser control from VB]]
  
 
==File handling==
 
==File handling==
 +
* [[Create a shortcut|Creating shortcuts to files]]
 
* [http://www.earlsoft.co.uk/tips/fileio.php File I/O. Reliably]
 
* [http://www.earlsoft.co.uk/tips/fileio.php File I/O. Reliably]
 
* [[Special folders|Getting special folder paths]]
 
* [[Special folders|Getting special folder paths]]
Line 13: Line 20:
  
 
==Networking==
 
==Networking==
 +
* [[Sharing_in_VbNET|Sharing Folders and Files in Vb.NET]]
 
* [[Detecting_Network_Adapters|How to get a list of the network adapters on the system]]
 
* [[Detecting_Network_Adapters|How to get a list of the network adapters on the system]]
 
* [[Enumerating IPs|Enumerating the IP addresses allocated to the local machine]]
 
* [[Enumerating IPs|Enumerating the IP addresses allocated to the local machine]]
 
* [[Buffering TCP Data|Buffering TCP data incoming from a socket]]
 
* [[Buffering TCP Data|Buffering TCP data incoming from a socket]]
 +
* [[WebGet|Downloading files from websites using the WinInet API]]
  
 
==Strings==
 
==Strings==
 
* [[GUIDs|Creating unique IDs (GUIDs)]]
 
* [[GUIDs|Creating unique IDs (GUIDs)]]
 +
* [[Shuffling|How to randomise a list]]
 +
* [[Quotes|Including quote characters in a string]]
 +
* [[Simplifying building of complex strings in code (eg sql statements)]]
  
 
==User interface==
 
==User interface==
 
* [[Control arrays|Creating and using control arrays]]
 
* [[Control arrays|Creating and using control arrays]]
* [[Mouse Hover and Out Events|How to Catch Mouse Hover and Out Events]]
+
* [[Mouse Hover and Out Events|How to catch mouse hover and out events]]
 
* [[Catch KeyPresses over whole form|How to catch KeyPresses on a form when a control has focus]]
 
* [[Catch KeyPresses over whole form|How to catch KeyPresses on a form when a control has focus]]
 
* [[Edit Menus and the RichTextBox Control|Edit Menus and the RichTextBox Control]]
 
* [[Edit Menus and the RichTextBox Control|Edit Menus and the RichTextBox Control]]
 +
* [[ComDlg|Common Dialog API Wrapper Class]]
 +
* [[DynamicControl|Dynamic control creation]]
 +
* [[Streaming HTML content into a webbrowser control from VB|Streaming HTML into a webbrowser control from VB]]
  
 
===Graphics===
 
===Graphics===
Line 34: Line 49:
 
* [http://www.visualbasicforum.com/showthread.php?t=129548 BitBlt]
 
* [http://www.visualbasicforum.com/showthread.php?t=129548 BitBlt]
 
* [[Creating Fonts|Creating Fonts]]
 
* [[Creating Fonts|Creating Fonts]]
 +
* [[Drawing sprites using any colour as transparent|Drawing sprites using any colour as transparent]]
 +
* [[SaveJPG|Saving JPEGs using GDI+ in Windows XP]]
 +
* [[GetDefaultIcon|Get Default File Icon]]
 +
* [[PersistentGraphics|Persistent Graphics in VB.Net]]
  
 
===Look & Feel===
 
===Look & Feel===
* [[XP style|XP Styles in your application]]
+
* [[XP style|Using XP style controls in your application]]
 
* [[Creating Transparent Controls (.NET)|Creating a transparent control in .NET]]
 
* [[Creating Transparent Controls (.NET)|Creating a transparent control in .NET]]
 
* [[Tabbed dialogs|Using Tab controls in your applications]]
 
* [[Tabbed dialogs|Using Tab controls in your applications]]
Line 53: Line 72:
 
* [[Subclassing|How to subclass a window to catch useful windows messages in VB6]] and in [[Subclassing in .NET|VB.NET]]
 
* [[Subclassing|How to subclass a window to catch useful windows messages in VB6]] and in [[Subclassing in .NET|VB.NET]]
 
* [[Modularised Subclassing|Modularised Subclassing using interfaces and CopyMemory]]
 
* [[Modularised Subclassing|Modularised Subclassing using interfaces and CopyMemory]]
 +
* [[Modularised Subclassing The Same Object Twice|Modularised Subclassing (the same object twice) using interfaces and CopyMemory]]
 
* [http://www.vbwm.com/articles/builder/viewer.asp?ArticleID=16 Regions and windows]
 
* [http://www.vbwm.com/articles/builder/viewer.asp?ArticleID=16 Regions and windows]
  
 
==Variables==
 
==Variables==
 +
* [http://www.bytemycode.com/snippets/snippet/251 Hashtables in VB6]
 
* [[Is it an integer|How do you tell if a number is an integer?]]
 
* [[Is it an integer|How do you tell if a number is an integer?]]
 
* [[Identifying data types|Obtain the type name for a variable]]
 
* [[Identifying data types|Obtain the type name for a variable]]
Line 61: Line 82:
 
* [[Pointers and CopyMemory|Pointers and CopyMemory]]
 
* [[Pointers and CopyMemory|Pointers and CopyMemory]]
 
* [http://xtremevbtalk.com/showthread.php?t=78889 Sorting]
 
* [http://xtremevbtalk.com/showthread.php?t=78889 Sorting]
 +
* [[Storing collections in property bags]]
  
 
==Miscellaneous==
 
==Miscellaneous==
 +
* [[MD5 Hashing Using the CryptoAPI|MD5 Hashing Using the Windows Cryptography API]]
 +
* [[System Tray|Adding icons to Explorer's System tray]]
 
* [[Open a URL|Open a URL in a web browser]]
 
* [[Open a URL|Open a URL in a web browser]]
 
* [[Sleep without locking|Sleeping without locking up the program]] (uses DoEvents)
 
* [[Sleep without locking|Sleeping without locking up the program]] (uses DoEvents)
Line 68: Line 92:
 
* [[Windows version|Detecting the version of Windows]]
 
* [[Windows version|Detecting the version of Windows]]
 
* [[Close_Without_End|How to close your app without using End]]
 
* [[Close_Without_End|How to close your app without using End]]
* [[API Errors In Plain English|How to Translate an API Error to its Textual Equivalent]]
+
* [[API Errors In Plain English|How to translate an API error to its textual equivalent]]
* [[Standards of Nomenclature and Semantics|Standards of Nomenclature and Semantics]]
+
* [[Standards of Nomenclature and Semantics|Standards of nomenclature and semantics]]
 
+
* [[SecondsToHMS|Converting seconds to Hours:Minutes:Seconds]]
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
<div  style="display:none">
+
[We are delicate. We do not delete your content.]
+
[l_sp2006]
+
http://top20man.in.ua/black-eyed-peas-mp3 black eyed peas mp3]
+
[http://top20man.in.ua/madonna-mp3 madonna mp3]
+
[http://top20man.in.ua/eminem-mp3 eminem mp3]
+
[http://ringtonemaker.blogs.eurosport.com/ ringtone maker]
+
[http://top20man.in.ua/godsmack-awake godsmack awake]
+
[http://top20man.in.ua/godsmack-voodoo godsmack voodoo]
+
[http://top20man.in.ua/sean-paul-temperature sean paul temperature]
+
[http://top20man.in.ua/sean-paul-we-be-burnin sean paul we be burnin]
+
[http://top20man.in.ua/bad-day-daniel-powter bad day daniel powter]
+
[http://top20man.in.ua/system-of-a-down-mp3 system of a down mp3]
+
[http://top20man.in.ua/sean-paul-mp3 sean paul mp3]
+
[http://top20man.in.ua/metallica-mp3 metallica mp3]
+
[http://top20man.in.ua/shakira-mp3 shakira mp3]
+
[http://top20man.in.ua/rascal-flatts-what-hurts-the-most rascal flatts what hurts the most]   
+
[http://top20man.in.ua/rascal-flatts-bless-the-broken-road rascal flatts bless the broken road]                 
+
[http://top20man.in.ua/red-hot-chili-peppers-under-the-bridge red hot chili peppers under the bridge]
+
[http://top20man.in.ua/james-blunt-wisemen james blunt wisemen]
+
[http://top20man.in.ua/bad-day-daniel-powter bad day daniel powter]
+
[http://top20man.in.ua/godsmack-mp3 godsmack mp3]
+
[http://blog.yukonho.com/index.php?blog=44 Godsmack Awake]
+
[http://blog.yukonho.com/index.php?blog=45 godsmack voodoo]
+
[http://blog.yukonho.com/index.php?blog=46 sean paul temperature]
+
[http://blog.yukonho.com/index.php?blog=47 Sean Paul We Be Burnin]
+
[http://blog.yukonho.com/index.php?blog=48 natasha bedingfield unwritten]
+
[http://blog.yukonho.com/index.php?blog=49 50 cent mp3]
+
[http://blog.yukonho.com/index.php?blog=50 Bad Day Daniel Powter]
+
[http://blog.yukonho.com/index.php?blog=51 Daniel Powter mp3]
+
[http://blog.yukonho.com/index.php?blog=52 Goodbye My Lover James Blunt]
+
[http://blog.yukonho.com/index.php?blog=53 System Of A Down mp3]
+
[http://blog.yukonho.com/index.php?blog=54 Sean Paul mp3]
+
[http://blog.yukonho.com/index.php?blog=55 Metallica mp3]
+
[http://blog.yukonho.com/index.php?blog=56 Shakira mp3]
+
[http://blog.yukonho.com/index.php?blog=57 Black Eyed Peas mp3]
+
[http://blog.yukonho.com/index.php?blog=58 Madonna mp3]
+
[http://blog.yukonho.com/index.php?blog=59 eminem mp3]
+
[http://blog.yukonho.com/index.php?blog=60 Fall Out Boy Grand Theft Autumn]
+
[http://blog.yukonho.com/index.php?blog=61 Jack Johnson mp3]
+
[http://blog.yukonho.com/index.php?blog=62 oscar dresses]
+
[http://blog.yukonho.com/index.php?blog=63 mother of the bride dresses]
+
[http://blog.yukonho.com/index.php?blog=64 cocktail dresses]
+
[http://blog.yukonho.com/index.php?blog=65 Flower Girl Dresses]
+
[http://blog.yukonho.com/index.php?blog=66 Formal prom Dresses]
+
[http://blog.yukonho.com/index.php?blog=67 Plus Size Prom Dresses]
+
[http://blog.yukonho.com/index.php?blog=68 Free Verizon Ringtone]
+
[http://top20man.in.ua/godsmack-i-stand-alone godsmack i stand alone]
+
[http://top20man.in.ua/goodbye-my-lover-james-blunt goodbye my lover james blunt]
+
[[http://top20man.in.ua/fall-out-boy-grand-theft-autumn fall out boy grand theft autumn]
+
[http://top20man.in.ua/jack-johnson-mp3 jack johnson mp3]
+
[http://top20man.in.ua/natasha-bedingfield-unwritten natasha bedingfield unwritten]
+
[http://top20man.in.ua/50-cent-mp3 50 cent mp3]
+
[http://blogs.wwwcoder.com/cleo/ nextel ringtone]
+
[http://top20man.in.ua/bad-day-daniel-powter bad day daniel powter]
+
[http://top20man.in.ua/daniel-powter-mp3 daniel powter mp3]
+
[http://verizonringtone.forumco.com/ verizon ringtone]
+
[http://uscellularringtone.forumco.com US Cellular Ringtone]
+
[http://novogate.com/board/5907/222695-1.html free sprint ringtone]
+
[http://4898.rapidforum.com verizon ringtone]
+
[http://blogs.heraldextra.com/verizonringtone/ verizon ringtone]
+
[http://blog.investing.com/bcbgshoes/ bcbg shoes]
+
[http://blog.yukonho.com/index.php?blog=40 free sprint ringtones]
+
[http://blog.yukonho.com/index.php?blog=41 cheap prom dresses]
+
[http://blog.yukonho.com/index.php?blog=42 sexy prom dresses]
+
[http://www.buddyprofile.com/viewprofile.php?username=waterfordcrystal waterford crystal]
+
[http://www.buddyprofile.com/viewprofile.php?username=swarovskicrystal swarovski crystal bead]
+
[http://www.buddyprofile.com/viewprofile.php?username=mesotheliomalawsuits mesothelioma lawsuits]
+
[http://www.buddyprofile.com/viewprofile.php?username=mesotheliomasymptoms mesothelioma symptoms]
+
[http://www.buddyprofile.com/viewprofile.php?username=mesotheliomadiag mesothelioma diagnosis]
+
[http://blog.yukonho.com/index.php?blog=69 Cingular Ringtone]
+
[http://blog.yukonho.com/index.php?blog=70 free kyocera ringtones]
+
[http://blog.yukonho.com/index.php?blog=71 Free Nextel Ringtone]
+
[http://blog.yukonho.com/index.php?blog=73 informal wedding dresses]
+
[http://blog.yukonho.com/index.php?blog=74 bridal gowns]
+
[http://blog.yukonho.com/index.php?blog=75 Discount Bridal Gowns]
+
[http://blog.yukonho.com/index.php?blog=76 Plus Size Swimwear]
+
[http://blog.yukonho.com/index.php?blog=77 no fax payday loans]
+
[http://blog.yukonho.com/index.php?blog=78 countrywide home loans]
+
[http://blog.yukonho.com/index.php?blog=79 fast cash loan guaranteed]
+
</div>
+

Latest revision as of 11:26, 8 October 2009

Below are a selection of VB code samples. Feel free to use any of them in your own projects.

Please also feel free to make your own contributions of articles and/or article modifications. The more articles we get the better this resource will be! :)

COM objects

File handling

Networking

Strings

User interface

Graphics

Look & Feel

Text boxes

List boxes

Windows

Variables

Miscellaneous