Atlanta Custom Software Development 

 
   Search        Code/Page
 

User Login
Email

Password

 

Forgot the Password?
Services
» Web Development
» Maintenance
» Data Integration/BI
» Information Management
Programming
VB VB (1648)
VB.net VB.net (736)
C# C# (15)
ASP.net ASP.net (779)
ASP ASP (41)
VC++ VC++ (25)
PHP PHP (0)
JAVA JAVA (4)
JScript JScript (5)
  Database
» SQL Server (708)
» ORACLE (5)
» MySQL (0)
» DB2 (0)
Automation
» C/C++/ASM (11)
» Microcontroller (1)
» Circuit Design (0)
OS/Networking
» Networking (5)
» Unix/Linux (1)
» WinNT/2k/2003 (8)
Graphics
» Flash (0)
» Maya (0)
» 3D max (0)
» Photoshop (0)
Links
» ASP.net (2)
» PC Interfacing (1)
» Networking (4)
» SQL Server (4)
» VB (23)
» VB.net (4)
» VC (3)
» HTML/CSS/JavaScript (10)
Tools
» Regular Expr Tester
» Free Tools

Submitted By : Nayan Patel  (Member Since : 5/26/2004 12:23:06 PM)

Job Description : He is the moderator of this site and currently working as an independent consultant. He works with VB.net/ASP.net, SQL Server and other MS technologies. He is MCSD.net, MCDBA and MCSE. In his free time he likes to watch funny movies and doing oil painting.
View all (893) submissions by this author  (Birth Date : 7/14/1981 )

Dynamically setting an event handler for a class' event via reflection
Total Hit (2743) Here it is some code that shows how to use reflection to dynamically set an event handler for a class' event. «Code LangId=2» Sub TestSub() ' create a Person Dim pe As New Person() ' get a reference to the EventInfo for this object Dim peEv As EventInfo = pe.GetType.GetEv ....Read More
Rating
Implementing IClonable - Shallow copies
Total Hit (2530) An object that want to support cloning should implement the ICloneable interface. This interface exposes only one method, Clone, which returns a copy of the object. The ICloneable specifics don't specify whether the object that the Clone method returns is a shallow copy or a deep copy. The differenc ....Read More
Rating
Implementing ICloneable - Deep copies
Total Hit (3355) The simplest way to create a generic deep copy routine, that is a procedure that can create a true, distinct copy of an object and all its dependent object, is to rely on the serialization features of the .NET framework. «Code LangId=2» Function CloneObject(ByVal obj As Object) As Object ' ....Read More
Rating
Set up event handlers through reflection
Total Hit (2523) Reflection makes it easy to invoke a method (or assign a field or a property) by its name. For example, suppose you have the following classes: «Code LangId=2» Class Person Event PropertyChanged(ByVal propertyName As String, ByVal newValue As Object) Dim m_Name As String Property ....Read More
Rating
Always declare objects with full library name
Total Hit (2833) If your application uses objects from external components, either third-party or your own libraries, a good rule of thumb is to include the complete servername.classname string in the Dim statement, as in: «Code LangId=1» Dim word As Word.Application «/Code» This syntax ensures that if you th ....Read More
Rating
Always run a component using Full-Compile
Total Hit (2724) When testing a component in the IDE, always perform a full compilation. This ensures that VB checks the syntax of all the code in the component, which in turn guarantees that no syntax error will break the program while it is serving another application. You can activate the full compilation opti ....Read More
Rating
Check a GUID
Total Hit (2886) The following routine quickly check that a string contains a valid GUID. Of course, it doesn't check that the GUID refers to a valid entity, but at least it lets you quickly reject invalid values: «Code LangId=1» Function CheckGUID(Value As String) As Boolean Const PatternGUID = "{####### ....Read More
Rating
Compound member attributes
Total Hit (2676) The Procedure Attributes dialog includes a Procedure ID combo box, that lets you associate a particular ID to a given member of the class. You usually use this combo to make a property or a method the default item of a class or an ActiveX control, but there are other uses as well. For instance, you ....Read More
Rating
Correct usage for binary compatibility settings
Total Hit (2960) When working on an updated version of a COM component, you should always enforce Binary Compatibility in the Component tab of the Project Properties dialog box. When enforcing binary compatibility there are a number of common mistakes that you should stay clear of: Always use the last EXE or DLL ....Read More
Rating
Create a GUID
Total Hit (3861) When you build your ActiveX controls and components, Visual Basic automatically creates all the GUIDs as necessary. The same also happens in other cases, without you even realizing it: for instance when you make a MDB database replicable, the Jet Engine adds new fields and uses GUIDs to mark their c ....Read More
Rating
Create stand-alone type libraries
Total Hit (3115) Many VB programmers assume that Visual Basic 5.0 is not capable of creating stand-alone Type Libraries, because the documentation states that when an ActiveX component or control is created, the companion Type Library is embedded in the main executable file. This is correct, but if you own the E ....Read More
Rating
Creating help string for Enum constants
Total Hit (3005) I've been trying to find a way to assign helpstrings for Enums in Visual Basic. The Class builder utility does that only for methods, events, and properties, but not for Enums. The IDL source code that corresponds to an Enum in a type library looks something like follws, and you can run the MIDL ....Read More
Rating
Don't include Extender properties in ActiveX Wizard
Total Hit (3071) The left-most listbox in the first page in the ActiveX Control Interface Wizard includes all the properties exposed by the constituent controls currently on the UserControl's surface. Unfortunately, this list includes Extender properties, methods, and events, which should be never added to the publi ....Read More
Rating
Don't pass Private objects to client applications
Total Hit (2817) Under some circumstances, an ActiveX DLL can pass private objects to its client application, for example a reference to a control that belongs to a form in the DLL. While this approach can be useful, and can work under some circumstances, you should absolutely avoid avoid to do so, because it might ....Read More
Rating
Enum constants that include spaces
Total Hit (2783) If you're writing an ActiveX control, you can create properties that return an enumerated value, as in: «Code LangId=1» Public Enum SizeConstants SizSmall = 1 SizMedium SizLarge End Enum Public Size As SizeConstants «/Code» When another developer is using your control, an enu ....Read More
Rating
Get the Command$ value from inside an ActiveX DLL
Total Hit (3086) At times you may need to access the command line passed to the application from within an ActiveX DLL. Unfortunately, when inside a DLL the Command$ function returns a null string, so you have to resort to some API trickery: «Code LangId=1» Private Declare Function GetCommandLine Lib "kernel32" ....Read More
Rating
Hide the Automation Manager
Total Hit (3324) If you haven't switched to DCOM yet, and still use Remote OLE Automation, you must launch the Automation Manager program on the server machine, in order to let the server respond to requests coming from client workstations. The Automation Manager displays a visible window at launch time, which t ....Read More
Rating
Never mix SingleUse and MultiUse classes
Total Hit (2756) ActiveX components written in VB can contain both SingleUse and MultiUse classes at the same time. It usually isn't a good idea to use both types of classes in the same project, however. When a client creates an instance of a SingleUse class, COM always runs a new instance of the EXE file that ex ....Read More
Rating
Storing objects in the Tag property
Total Hit (4400) The Tag property exposed by many Windows Common Controls (including TreeView's Node objects and ListView's ListItem objects) is more versatile than the ListBox and ComboBox controls' ItemData property, because it is of Variant type and can therefore accept values of most data types. However, it ....Read More
Rating
Updating records in DataList and ADO Data Controls
Total Hit (3917) If you use a DataList control linked to an ADO Data Control and if you want to add a record, you have to create a command button with this code: «Code LangId=1» Private Sub cmdAdd_Click() On Error GoTo AddErr datPrimaryRS.Recordset.AddNew txtNew.SetFocus Exit Sub AddErr: MsgBox ....Read More
Rating
A template for building collection class modules
Total Hit (3513) The following is a template for building collection class modules in a very quick and effective way. Copy-and-paste this code into Notepad, that save it to a file named "COLLECTION CLASS.CLS" in the \TEMPLATE\CLASSES subdirectory under the main VB6 directory: «Code LangId=1» VERSION 1.0 CLASS B ....Read More
Rating
Better type checking in Variant properties that can accept objects
Total Hit (2812) As explained in the Mistake Bank you need all three flavors of Property procedures to correctly implement a Variant property that can take either an object or a non-object value. Surprisingly enough, in this case you don't need that the argument of the Property Set procedure be declared As Variant. ....Read More
Rating
Default Properties tend to hide programming mistakes
Total Hit (2763) Visual Basic lets you create a default property or method by simply selecting the "(Default)" item in the combo box that appear if you click the Advanced button in the Procedure Attributes dialog box. (You can display this dialog from the Tools menu, or by right-clicking on a property name in the ri ....Read More
Rating
Don't test auto-instancing variables using Is Nothing
Total Hit (2869) You can't reliably test an auto-instancing object variable using the Is Nothing test, because as soon as you reference the variable Visual Basic silently creates an object of the given class, and the test always returns False: «Code LangId=1» Dim x As New MyClass If x Is Nothing Then ' this ....Read More
Rating
Friend Procedures are faster than Public ones
Total Hit (2956) It might surprise you to learn that Friend procedures are sensibly faster than Public ones. You can prove this yourself by creating an ActiveX EXE project with one Private class and one Public class (Instancing = MultiUse), and then add the following code in both class modules: «Code LangId=1» P ....Read More
Rating
Implement Write-Once Read-Many Properties
Total Hit (3953) Creating a read-only property or a write-only property isn't difficult, as you probably know: just omit the Property Let (or Set, if dealing with objects) or the Property Get procedure, respectively. There are cases, however, when you want to implement a write-only-read-many property, that is, a ....Read More
Rating
Passing Public class variables by reference
Total Hit (2914) Under VB4 Public variables in form and class modules were implemented in the same manner as variables in BAS modules, that is, as direct references to memory locations. This allowed VB programmers to create procedures that modified values passed by reference, as in: «Code LangId=1» '--- the CIn ....Read More
Rating
Use Objptr function to quickly locate an object in a Collection
Total Hit (3119) One of the simplest and most effective uses of the ObjPtr function is to provide a key for quickly locating an object in a Collection. Let's suppose you have a collection of objects that don't have a property that can be used as a key to retrieve them in a collection. You can work around this by usi ....Read More
Rating
Use ObjPtr to test whether two object variables point to the same object
Total Hit (2722) The standard way to test whether two object variables point to the same object is through the Is operator, as in: «Code LangId=1» If obj1 Is obj2 Then ... «/Code» However, when both object are of the same type, or point to the same secondary interface, you can slightly optimize your code by t ....Read More
Rating
Using CallByName with nested objects
Total Hit (3117) Sometimes Microsoft documentation can be, well lacking is a kind word, and one is reluctant to call tech support when they smoke your credit card first, and ask questions later. My problem was that the CallByName procedure was refusing to call nested lasses. To see what I mean, consider that if y ....Read More
Rating


(Page 121 of 133) 3968 Result(s) found  ... 121 122 123 124 125 126 127 128 129 130 131 132 133

Home   |  Comment   |  Contact Us   |  Privacy Policy   |  Terms & Conditions   |  BlogsZappySys

© 2008 BinaryWorld LLC. All rights reserved.