Solved

Dim Statement

Posted on 2011-02-27
8
274 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 168 total points
Comment Utility
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 85

Assisted Solution

by:Mike Tomlinson
Mike Tomlinson earned 166 total points
Comment Utility
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 166 total points
Comment Utility
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
Comment Utility
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

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

This is an addendum to the following article: Acitve Directory based Outlook Signature (http://www.experts-exchange.com/Programming/Languages/Visual_Basic/VB_Script/Q_24950055.html) The script is fine, and works in normal client-server domains…
Article by: gr8gonzo
Git can be a complicated version control system for beginners, but it definitely is one of the best ones out there. Since this article assumes that you're starting at square one, it will skip over things that Git -can- do and will focus on the typic…
This video discusses moving either the default database or any database to a new volume.
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

763 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

Need Help in Real-Time?

Connect with top rated Experts

6 Experts available now in Live!

Get 1:1 Help Now