Dec 222017
Formatted input routine for Visual Basic for DOS. Freeware.
File VBDFMT10.ZIP from The Programmer’s Corner in
Category BASIC Language
Formatted input routine for Visual Basic for DOS. Freeware.
File Name File Size Zip Size Zip Type
FMT1.FRM 6155 3170 deflated
README.TXT 3134 1451 deflated
TPCREAD.ME 199 165 deflated
VBDFMT.BAS 3781 801 deflated
VBDFMT.BI 2262 913 deflated
VBDFMT.MAK 22 22 stored

Download File VBDFMT10.ZIP Here

Contents of the README.TXT file


BASIC never had a formatted input routine. I know many hours have
been spent and many lines of code have been written to provide programmers
this feature. Most of us relied on INKEY$ in QuickBASIC and PDS and then
along comes VBDOS. INKEY$ doesn't work when forms are showing (but why
else use VBDOS?).

VBDFMT is an attempt to overcome one of BASIC's shortcommings. It is
fairly simple and easy to use, but by no means complete. I've attempted to
emulate some of dBASE character formats simply for familiarity.

There should be five files in this package:
README.TXT - The one your reading now.
VBDFMT.BI - The $INCLUDE: file; shortend CONSTANT.BI
VBDFMT.BAS - The Code Routines
VBDFMT.MAK - The Project File

Using VBDFMT is easy as this:

First enter the format string into the Text.Tag property.
Mask for phone number including area code.
(###) ###-####

Spaces are considered part of the format mask. You could
add/delete delimiters by editing the delim string found in
the VBDFMT.BI file.

Add this line to under the KeyPress subroutine.

kInp Text1(Index),KeyAscii,Jump,GoodAnswer$

Text(Index) - is the control name. Index is used when
Text Boxes are in an array.

KeyAscii - Ascii value of the key pressed.

Jump - Used when automatic jump to next text box
is desired. (see code example)

GoodAnswer$ - Used when a restricted response is desired.
Such as a TRUE/FALSE or YES/NO or a range
1,2, or 3 etc... (see code example)

Call kInp from the KeyPress Subroutine. KeyDown and KeyUp send
keyboard scan codes and kInp will not work properly. I guess you
could change it if you want to though.

I have not worked out the insert routine yet. Everything else
works fine though. Backspace, Delete, Home, End, Arrow keys. There is a
irritating (in this routine at least) quirk with the END key that moves
the cursor to the end of the padded string. I've limited it to the end of
the format string at least. It can be disabled if you want by deleting
the Key_Down routine found in the FORM.

I place this routine in the public domain for use by anyone for any
reason. The only thing I ask if any improvements are made (there is room
for plenty) that a copy be uploaded to the BBS you got this from and under
a different file name so I won't get confused. Or you could let me know
directly. Send any correspondence to:

Richard K. McGhinnis
646 Connelly Springs Rd.
Lenoir, NC 28645
(704) 728-4048 Home-Voice
(704) 757-1277 Work-Voice

Happy Programming!

 December 22, 2017  Add comments

 Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>