Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / New Users / October 2007

Tip: Looking for answers? Try searching our database.

VB Assistance

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
kirad832 - 30 Oct 2007 19:18 GMT
I am working on an assignment and need some assistance if anyone could help:

Need to use a for next statement and give a value to five elements usin a
one dimensional integer array value

So far I have

Sub Main()
Dim integer As Integer
Dim Value as Integer
Value = 8

For Integer = 1 to 5

I don't know how to continue this..any suggestions??

Thanks
Scott M. - 30 Oct 2007 20:11 GMT
You should never name something using a reserved word, like "integer" (VB is
not a case-sensitive language so "integer" and "Integer" are the same
thing).  You were also unclear as to whether you already have 5 values and
just need to assign them to members of an array or whether you are using
values from the array to assign to 5 "elements" (whatever that means)
somewhere else.

Here's my best guess at what you are trying to do:

Sub Main()
   Dim values As Integer(4)    'Notice the trailing parenthesis ()?  This
means values should be an Integer array
   values(0) = 27    'Made up value
   values(1) = 32    'Made up value
   values(2) = 16    'Made up value
   values(3) = 7    'Made up value
   values(4) = -12    'Made up value

   'This assumes you already have some "element" (as you call it) and since
I don't know what you mean
   'by "element", I can't know what property to set on it.  But, this
should give you the idea
   For i As Integer = 0 to values.length - 1
       element(i) = values(i)
   Next

End Sub

> I am working on an assignment and need some assistance if anyone could
> help:
[quoted text clipped - 14 lines]
>
> Thanks

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.