devxlogo

We are an award-winning tech entrepreneurship website where trusted experts can provide value globally.

Since 1998, DevX has helped people start businesses, build websites, and provide enterprise technology to people globally. Interviewing the likes of Microsoft’s co-founder, Steve Ballmer, the publication brings comprehensive, reliable, and accessible insights to the Internet.

devxlogo

Trusted for 26 years

Over 30K Articles

1M+ Readers

Expert-reviewed

10K+ Tech Terms

As seen in:

microsoft logo
business_insider_logo
wired_logo
berkley
arstechnica_logo
hackernoon

The Latest

How to Calculate the X, Y of any Position on a Circle

The DegreesToXYsubroutine, part of CodeBank’s standard procedurelibrary, calculates the X (horizontal) and Y (vertical) coordinatesof any point, measured in degrees, on the circumference of a circleor ellipse. As you can

Does an Object Have a Value?

You cannot use the IsEmpty function to determine if a variableof type Form or any Object has been assigned a value. You can,however, use this method to determine if the

Close VB Before Compiling

When you’re finished tinkering with your apps, close and restart VBbefore making the final EXE. This simple action can reduce the size ofyour EXE by 10 to 30 percent (many

Load a VB4 Form in VB3

You cannot load a VB4 form in VB3 directly. You must modify theform definition. When you open a VB4 form, the file will resemblethe example: VERSION 4.00Begin VB.Form Form1 Caption

Converting Identifiers into Labels and Column Headings

Programmers are in the habit of creating meaningful identifiersby concatenating the words of a “title case” phrasethat describes the identifier, such as LastName or FinalPaymentDate.Often, you can use these names

Create A Controlled DoEvents

I needed a way to issue a DoEvents to allow Windows time to redraw controlson a form, but wanted to prevent the user from clicking some other controlwithin my application.

Selecting The Text When Entering A Field

In many cases, it is best to select or highlight the full text of afield when that field gains the focus. This allows the user to simply begintyping to replace

Correctly Convert SQL Server Floats By Jet

When using the SQL Server ODBC driver and SQL Server, and If ODBC preparedexecution is used, certain floating-point values may be incorrectly converted.Microsoft Access and Microsoft Visual Basic commonly use

File Exists?

One way to test whether a specific file exists is to open thefile for input and check VB’s error flag. An error will occurif the file does not exist. Use

Lost Long File Names?

Never, never, never assume that a given API call or control/OCXworks the same under Win95 and Windows NT. For example, the 32-bitfile common dialog handles long file names, right? Well,

Successfully Close ODBC Connections

The Microsoft Access engine will maintain a persistent connection onan ODBC connection in order to be more efficient, even after using a Closemethod on a database opened with ODBC. The

VB Shortcuts with Windows 95

With the release of VB4 and the new development environment for32-bit operating systems, I use three versions of Visual Basicin developing VB applications. Some of my clients won’t acceptapps built

New Registry Functions

There is a list of our new functions in Visual Basic 4.0 for workingwith an application’s Windows registry entries (or .INI file on16-bit Windows platforms): GetSetting(appname, section, key[, default]) GetAllSettings(appname,

Print A Single Sub Or Function

The problem? You want to print a single sub but VB always prints allthe subs that are in the current form. You could copy it to the clipboardand print it

Give Focus To Another 16-Bit Application In NT

Note that in writing in VB3.0, Visual Basic’s AppActivate statementfails to make a 32-bit application the active window under Windows NT.For example: Sub Form_Load () AppActivate “Notepad – (Untitled)”End Sub

Check for NULLs Returned from DLL Calls

After a call to a DLL, the return value often contains a null.One way to eliminate the null is to look for Chr$(0), as in theexample: Dim CheckForNull As IntegerCheckForNull

Monitor Resolution Through API

There is a simple way to get Monitor resolutions through a WinAPIcall. Declare this in a module: Declare Function GetsystemMetrics Lib “User” (ByVal _ nIndex As Integer) As Integer And

Unload All Forms

Public Sub UnloadAll()Dim f As Integerf = Forms.CountDo While f > 0 Unload Forms(f – 1) ‘ If form isn’t unloaded exit (User had canceled…) If f = Forms.Count Then

A Replacement For Tabs

You say you want to use a tab control, but you have so many topics thetabs will be unreadable? Try using a list box in conjunction with a controlarray of

Jump To A Function Within Your Project

When you are looking at code that calls a function or procedure andyou are not sure in which module the function or procedure is defined,you can highlight/procedure name and press

Dragging A Form By A Control

This code is reusable and small enough to paste into whatever you’redoing and instantly have a form that has no need for a title bar. In thegeneral declarations section, insert

Printer Object Quirk

You would think that the following code would change the current fontof the default printer, but it doesn’t under VB4: Printer.FontName = “Arial”Printer.FontSize = 11Printer.Print “This is a test.” An

Using Components

Creating a new project with a lot of old components? In VB 4.0 you candrag and drop files into the project window to add them to the project.Use File Manager

Fix For Data Control Error 3426

This code, which works fine under VB3, may generate runtime error 3426–“Theaction was canceled by an associated object”–in the 16-bit versionof VB4: Private Sub cmdUpdate_Click() ‘ Save contents of bound

Error in DBGrid

The documentation for the DBGrid in VB4’s Professional and EnterpriseEditions states that the control’s Text and Value properties allow youto read or set the contents of a cell. This would

Programmatically Close The Binder Object

Because of customer complaints and confusion, Microsoft Office applicationswill begin to implement this strategy for programmatically closing Officeapplications. First, hide the object by setting Object.Visible to false.Then let the object

Error When Setting DBCombo MatchEntry Property

When you try to set the MatchEntry property of a DBCombo control to”1 – Extended Matching”(at run time or design time), VB may reportthat the “Property is read-only.” The problem