Wrox Programmer Forums
|
Beginning VB 6 For coders who are new to Visual Basic, working in VB version 6 (not .NET).
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Beginning VB 6 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 1st, 2006, 01:35 AM
Friend of Wrox
 
Join Date: Jan 2006
Posts: 180
Thanks: 1
Thanked 1 Time in 1 Post
Send a message via ICQ to dpkbahuguna Send a message via MSN to dpkbahuguna Send a message via Yahoo to dpkbahuguna
Default Defining the Variables.

Hi All !!


   There is any way to define many integer in short into VB.

   Like c language and other......
   int a, b, c, d;


   instead of [ dim a as integer, b as integer, c as integer ]

   I am asking this basically to reduce the length of source ....

   Thanks in advance...:)

DPK..
__________________
DPK..
 
Old November 1st, 2006, 10:16 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,189
Thanks: 5
Thanked 59 Times in 57 Posts
Send a message via MSN to gbianchi
Default

well.. there is a way to do that.. but I don't recommend it...

(from msdn)
Deftype Statements

Used at module level to set the defaultdata type forvariables,arguments passed to procedures, and the return type for Function and Property Get procedures whose names start with the specified characters.


Code:
DefInt letterrange[, letterrange] . . .
letter1[-letter2]

The letter1 and letter2 arguments specify the name range for which you can set a default data type. Each argument represents the first letter of the variable, argument, Function procedure, or Property Get procedure name and can be any letter of the alphabet. The case of letters in letterrange isn't significant.

read more in msdn ;)

HTH

Gonzalo
 
Old November 1st, 2006, 12:40 PM
Friend of Wrox
 
Join Date: Nov 2004
Posts: 1,621
Thanks: 1
Thanked 3 Times in 3 Posts
Default

The ability you describe was added to VB.NET, but not VB6 and before.

As Gonzalo said, you can define a range of beginning letters to be implicitly of a certain type, but it makes your code hard to read. There is no indication at the point of the variables declaration what type it is.

It seems really useful at first, but 2 months after you do it, you'l' be asking yourself, "What is this variable’s type?"

Don't be tempted by the dark side. . .





Similar Threads
Thread Thread Starter Forum Replies Last Post
Defining a process snufse ASP.NET 2.0 Basics 5 April 23rd, 2008 07:13 AM
help with defining in the database derrida BOOK: Beginning PHP5, Apache, and MySQL Web Development ISBN: 978-0-7645-7966-0 0 April 14th, 2007 03:17 AM
Defining Methods for a WebService ename .NET Web Services 0 November 21st, 2006 12:01 PM
Problem with defining variables Asix Beginning PHP 6 February 14th, 2005 01:32 AM
Pre defining of a site. Sibrovvs Dreamweaver (all versions) 3 December 8th, 2004 07:16 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.