Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Dim Statement

Posted on 2011-02-27
8
Medium Priority
?
325 Views
Last Modified: 2014-06-27
I need a procedure to store the name of an item in inventory and its height and weight.  The height may have a decimal place ; the weight will be whole numbers only.  Write appropriate Dim statements to declare the necessary procedure-level variables.
0
Comment
Question by:RM0517
  • 2
8 Comments
 
LVL 21

Accepted Solution

by:
oleggold earned 672 total points
ID: 34992857
syntax of dim statement is
dim varname integer;
or
dim varname ;
We can write exact statement for You as it's against the rules
0
 
LVL 86

Assisted Solution

by:Mike Tomlinson
Mike Tomlinson earned 664 total points
ID: 34992942
Here are the data types in VB.Net:
http://msdn.microsoft.com/en-us/library/47zceaw7(VS.71).aspx

The keywords in your problem statement are:
The name of an inventory item.
Height may have a decimal place.
Weight will be whole numbers.

Which data types best fit these needs?
0
 
LVL 8

Assisted Solution

by:JT92677
JT92677 earned 664 total points
ID: 34994480
You are describing a "record" -- a type of variable that contains your date

Private Type InventoryType
    ID As Integer
    Weight as real
    Height as real
    Description as As String * 50
End Type

Dim InventoryItem As Inventory Type


you would then access the parts of the record e.g.
 
  InventoryItem.ID = 4324
  InventoryItem.Description = "This is a nail"
  InventoryItem.Weight

etc.

or using the With / end With block

   with InventoryItem
      id = 2342
      description = "this is a nail"
      weight = 3.4
   end with

Bottom line -- you are describing a "RECORD" type and need to keep the various attributes (description, weight, height, etc.) in a single record structure or record type.

Then you can create instances of the record using the DIM statement.

Hope this points you in the right direction

jeff
0
 
LVL 8

Expert Comment

by:JT92677
ID: 35003539
Any guess as to whether RM0517  will assign points to an answer?

The issue is about record types, but I don't see a solution to the "write a procedure" question, hopefully I haven't broken a rule by posting info on record types and how to access the fields within the record.

Ask a question, get an answer, didn't know about the homework rules, sorry. But don't think my suggestoins are a "complete solution" ??

Jeff
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Welcome back!  My apologies for taking so long to write part two of this series; it's been a long time coming!  As I promised in Part 1, this article will focus on how to locate those elusive AD properties that you are searching for.  Why is this us…
Introduction During my participation as a VBScript contributor at Experts Exchange, one of the most common questions I come across is this: "I have a script that runs against only one computer. How can I make it run against a list of computers in …
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
Suggested Courses
Course of the Month11 days, 10 hours left to enroll

916 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question