×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Question about saving string values to MD $ arrays

Question about saving string values to MD $ arrays

Question about saving string values to MD $ arrays

(OP)
Firstly I am a beginner so forgive my ignorance of some of the finer points of qbasic

I am writing a program that requires saving data to a multidimensional array

The data is read in and an input statement captures the change to the given column.


so the array is a string array and saves multiple types of data

the first input statement captures a number, and changes it correctly

however the second input statement captures a description of the item, but I am confused on what I need to change, here is my code.

1:
PRINT
INPUT "Enter new upc code"; hold
wally$(1, save) = STR$(hold)
RETURN
(WORKS)
2:
PRINT
INPUT "Enter new item description"; hold
wally$(2, save) = STR$(hold)
RETURN
(DOESN'T WORK)

I have tried to change the hold to a string value, and it allows me to use alphabetical characters for the input however I keep getting a change of 0 in the array. I am confused on how to make sure to capture the input and save it to the corresponding column.

I also tried changing STR$(hold) to STR$(hold$) but it keeps giving me a "Number required for function" error, what does this mean?

Thank you for reading this, I can supply any additional information upon request.

RE: Question about saving string values to MD $ arrays

Can you include the all relevant code? I don't want to assume the values of "save" and how the wally$ array is defined.

In order to accept an alphanumeric value from INPUT, the "capture" variable must be a string. You were right to use hold$

CODE

INPUT "Enter new item description"; hold$
wally$(2, save) = hold$ 

STR$() is a function that converts a number into a string. If the function receives a string instead of a number, you will get the error "Number required for function".

-Geates

http://ns7.webmasters.com/caspdoc/html/vbscript_la...

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close