February 19, 2000

Convert a color value to a gray scale

When you have a 32-bit color value, you can convert it to a grey-scale – that is, you can determine how it would appear on a monochromatic display (more or less) using the following function: Function GetGreyScale(ByVal lColor As Long) lColor = 0.33 * (lColor Mod 256) + 0.59 *

Create ListBox controls with companion priority buttons

You can easily create a ListBox control similar to the one found in the VB’s Project References dialog box, that lets you select multiple items and move them up and down using two companion buttons.First of all, create a ListBox control (say, List1) and two CommandButton controls to its right,

Dynamically bind a DataList or DataCombo control to an ADO Recordset

When dynamically changing the bound ADORecordset for a DataCombo or DataList control, the order you follow when assigning the properties is important. This is the correct sequence of operations to perform to change the bound recordset for these controls: ‘ unbind the current sourcesSet DataCombo1.DataSource = NothingSet DataCombo1.RowSource = Nothing’

Quickly create a copy of an ADO Recordset

When you want to process the data in a Recordset without affecting the actual values in the database, often the Clone method isn’t what you need. For example, if you delete the records in a cloned Recordset, the original data in the database is also affected.It seems that the only

Extract Red,Green,Blue components of a color

If you have a 32-bit color value in RGB format, you can extract its Red, Green and Blue components using the following routines: Function GetRed(ByVal lColor As Long) As Long GetRed = lColor Mod 256End FunctionFunction GetGreen(ByVal lColor As Long) As Long GetGreen = (lColor &H100) Mod 256End FunctionFunction GetBlue(ByVal

Provide Default Values for Applet Parameters

You can customize your applets by providing parameters at runtime in . But it is a good practice to always provide default values, when specific values for parameters are not provided. You can do this by checking for null values and/or proper type checking (if you expect numeric or date

Generate Random Numbers in Java

You can generate Random numbers in Java using the Random class available in java.util package. The following is a code which generates Random numbers between 0 and 100: import java.util.Random ;public class RandomGenerator { public static void main(String args[]){ int value = 101; Random rm = new Random(); // rm.nextInt()

Give Focus to a User-Select HTML Control in VID 6

Although the Scripting Object Model (SOM) in Visual InterDev 6 makes for quick development, it doesn’t cover all the functionality that you need. For example, in Visual Basic it is easy to give any control the focus. That functionality isn’t built in to VID 6, so you need a combination

Passing Primitive Data by Reference

Primitive datatypes in Java are always a passby value. You can pass them by reference, by wrapping the data in to single element array. Here is the code (Tested on Java 1.2) : public class PassByReferance { public static void main(String args[]){ double value = 1234.000; PassByReferance.manipulate(value); System.out.println(” Value of

No more posts to show