Solved

Dim Statement

Posted on 2011-02-27
8
277 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
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 85

Assisted Solution

by:Mike Tomlinson
Mike Tomlinson earned 166 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 166 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

When working in a large software development team, whether you have many developers working on the same projects, or your project is linked to other projects; it is very important that developers regularly perform "get latest" to ensure that the cha…
This article is the result of a quest to better understand Task Scheduler 2.0 and all the newer objects available in vbscript in this version over  the limited options we had scripting in Task Scheduler 1.0.  As I started my journey of knowledge I f…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
In this video I am going to show you how to back up and restore Office 365 mailboxes using CodeTwo Backup for Office 365. Learn more about the tool used in this video here: http://www.codetwo.com/backup-for-office-365/ (http://www.codetwo.com/ba…

867 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

12 Experts available now in Live!

Get 1:1 Help Now