Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Dim Statement

Posted on 2011-02-27
8
Medium Priority
?
311 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

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

Well hello again!  Glad to see you've made it this far without giving up.  In this, the fourth installment of my popular series, I'm going to cover functions and subroutines, what they are, and why they are useful.  Just in case you stumbled onto th…
This is pretty cool.  The purpose of this VB Script is to help you document where JAR (Java ARchive) files and specifically java class files are located so that you can address issues seen with a client or that you can speak intelligently with a dev…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…

721 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