469,946 Members | 1,800 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,946 developers. It's quick & easy.

converting old app to VB - strange INPUT behavior

OK guys, this is my first real attempt at VB. Actually my return to writing
programs since 1998. I've got an old DOS QB app that I am converting to VB
6.0. Really simple file formatting app.

the INPUT statement is behaving oddly. Picture a CSV file that looks like
this
Bill smith,123 Main St,Apt 3

and input statement like this:

Dim nm, ad1, ad2 as String
Input #filehandle, nm, ad1, ad2

What happens is that VB read the address value but only the numeric part
then puts the rest in the ad2 variable. So AD1 is now "123" and AD2 is
"Main St"

What am I doing wrong?

Paul
Nov 22 '05 #1
9 3775
Inline :-

On Sun, 20 Nov 2005 06:01:16 GMT, "Paul M. Cook"
<pm******************@gte.net> wrote:
OK guys, this is my first real attempt at VB. Actually my return to writing
programs since 1998. I've got an old DOS QB app that I am converting to VB
6.0. Really simple file formatting app.

the INPUT statement is behaving oddly. Picture a CSV file that looks like
this
Bill smith,123 Main St,Apt 3

and input statement like this:
Dim nm, ad1, ad2 as String
\___ this declares two Variants then one String
Input #filehandle, nm, ad1, ad2

What happens is that VB read the address value but only the numeric part
then puts the rest in the ad2 variable. So AD1 is now "123" and AD2 is
"Main St"

What am I doing wrong?

Paul


Nov 22 '05 #2

"Paul M. Cook" <pm******************@gte.net> skrev i en meddelelse
news:MiUff.2040$Vu2.369@trnddc06...
OK guys, this is my first real attempt at VB. Actually my return to
writing
programs since 1998. I've got an old DOS QB app that I am converting to
VB
6.0. Really simple file formatting app.

the INPUT statement is behaving oddly. Picture a CSV file that looks like
this
Bill smith,123 Main St,Apt 3

and input statement like this:

Dim nm, ad1, ad2 as String

WRONG!!

Do like this:
Dim nm As String,ad1 As String,ad2 As String

Nov 22 '05 #3
Even better, make you code neat for easier reference:

Dim nm As String
Dim ad1 As String
Dim ad2 As String
- Kev

"StoneWare" <He*******@NoSpam.Net> wrote in message
news:43**********************@dread11.news.tele.dk ...

"Paul M. Cook" <pm******************@gte.net> skrev i en meddelelse
news:MiUff.2040$Vu2.369@trnddc06...
OK guys, this is my first real attempt at VB. Actually my return to
writing
programs since 1998. I've got an old DOS QB app that I am converting to
VB
6.0. Really simple file formatting app.

the INPUT statement is behaving oddly. Picture a CSV file that looks
like
this
Bill smith,123 Main St,Apt 3

and input statement like this:

Dim nm, ad1, ad2 as String

WRONG!!

Do like this:
Dim nm As String,ad1 As String,ad2 As String


Nov 22 '05 #4

"StoneWare" <He*******@NoSpam.Net> wrote in message
news:43**********************@dread11.news.tele.dk ...

"Paul M. Cook" <pm******************@gte.net> skrev i en meddelelse
news:MiUff.2040$Vu2.369@trnddc06...
OK guys, this is my first real attempt at VB. Actually my return to
writing
programs since 1998. I've got an old DOS QB app that I am converting to
VB
6.0. Really simple file formatting app.

the INPUT statement is behaving oddly. Picture a CSV file that looks like this
Bill smith,123 Main St,Apt 3

and input statement like this:

Dim nm, ad1, ad2 as String

WRONG!!

Do like this:
Dim nm As String,ad1 As String,ad2 As String


Well yes, it was wrong. Which is why I came here :) Thanks guys. I'm
flying without a manual here so wish me luck.

Paul
Nov 22 '05 #5
On Mon, 21 Nov 2005 02:00:17 GMT, "Paul M. Cook"
<pm******************@gte.net> wrote:

<snip>
Do like this:
Dim nm As String,ad1 As String,ad2 As String


Well yes, it was wrong. Which is why I came here :) Thanks guys. I'm
flying without a manual here so wish me luck.


Do you have any form of Help System ?

If not I have a backup of the VB5 Help File at:

www.jerryfrench.co.uk/utils/vb5help.zip

VB5 is pretty much the same as VB6, although VB6 has a few more bells
and whistles
Nov 22 '05 #6

"J French" <er*****@nowhere.uk> wrote in message
news:43****************@news.btopenworld.com...
On Mon, 21 Nov 2005 02:00:17 GMT, "Paul M. Cook"
<pm******************@gte.net> wrote:

<snip>
Do like this:
Dim nm As String,ad1 As String,ad2 As String


Well yes, it was wrong. Which is why I came here :) Thanks guys. I'm
flying without a manual here so wish me luck.


Do you have any form of Help System ?

If not I have a backup of the VB5 Help File at:

www.jerryfrench.co.uk/utils/vb5help.zip

VB5 is pretty much the same as VB6, although VB6 has a few more bells
and whistles


I have VB 6 but I lost the MSDN CD with the help file. I'll try the one you
linked too. Thank you.

Paul
Nov 22 '05 #7
On Mon, 21 Nov 2005 19:28:21 GMT, "Paul M. Cook"
<pm******************@gte.net> wrote:

<snip>
VB5 is pretty much the same as VB6, although VB6 has a few more bells
and whistles


I have VB 6 but I lost the MSDN CD with the help file. I'll try the one you
linked too. Thank you.


You can regard the VB6 Help File as a VB6 Help File that is missing a
few items

- some people prefer it to MSDN
Nov 22 '05 #8

"J French" <er*****@nowhere.uk> wrote in message
news:43****************@news.btopenworld.com...
On Mon, 21 Nov 2005 19:28:21 GMT, "Paul M. Cook"
<pm******************@gte.net> wrote:
You can regard the VB6 Help File as a VB6 Help File that is missing a
few items


Was that a Freudian slip? :)
Nov 23 '05 #9
On Tue, 22 Nov 2005 18:28:04 -0800, "Steve Gerrard"
<my********@comcast.net> wrote:

"J French" <er*****@nowhere.uk> wrote in message
news:43****************@news.btopenworld.com...
On Mon, 21 Nov 2005 19:28:21 GMT, "Paul M. Cook"
<pm******************@gte.net> wrote:
You can regard the VB6 Help File as a VB6 Help File that is missing a
few items
Was that a Freudian slip? :)


Nuts ! <g>
Nov 23 '05 #10

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Jeff Homan | last post: by
1 post views Thread by Michael Bosco | last post: by
4 posts views Thread by jagmeena | last post: by
11 posts views Thread by Marlene Stebbins | last post: by
reply views Thread by the friendly display name | last post: by
10 posts views Thread by John Kraft | last post: by
2 posts views Thread by danep2 | last post: by
20 posts views Thread by Pilcrow | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.