version of vb (1 Viewer)

What version of VB

  • Vb.net

    Votes: 3 21.4%
  • vb6

    Votes: 10 71.4%
  • earlier than vb6

    Votes: 0 0.0%
  • no vb what so evr

    Votes: 1 7.1%

  • Total voters
    14
Joined
May 27, 2004
Messages
107
Gender
Male
HSC
2004
lol i had seen i sed not vb
and c is more complex for newer programmers than vb

and i can use non event and non obejct orientated aswell
 
Joined
May 27, 2004
Messages
107
Gender
Male
HSC
2004
lol while i got u vb.net programmers

dim number as array()
dim i as integer

for i = 0 to 8

number(i) = i
next i

there is an error and says i cannot place a string or integer value in there how do i place a value in an array
 

Winston

Active Member
Joined
Aug 30, 2002
Messages
6,128
Gender
Undisclosed
HSC
2003
That's because Array carries Objects, and you're storing a primitive type inside it, and you shouldn't really declare array, you'd most probably be best to declare an integer type array.

Dim IntegerArray(40) As Integer


For i As Integer = 0 To 8

IntegerArray(i) = i

Next i

so it declares a size integer array with 40 spaces, and yeah uses your code above
 
Joined
May 27, 2004
Messages
107
Gender
Male
HSC
2004
lol ok two questions for ya winston...

1.. how do i create an array with the characters a to z in it

2... winston are u a teacher, student like what is ur occupation... jus wondering
 

J0n

N/A
Joined
Aug 28, 2003
Messages
410
Gender
Male
HSC
2004
1. Well i'm no .NET'er (and no Winston ;)), but from what's been posted already, i think this should work:
Dim CharArray(25) As Char

For i As Integer = 97 To 122

CharArray(i - 97) = Chr(i)

Next i

That should just cycle through the ascii codes from ascii of 'a' to the ascii code of 'z' and assign the character corresponding to each code to the corresponding element in the array.
 
Joined
May 27, 2004
Messages
107
Gender
Male
HSC
2004
hey thanks that worked and ok now i need to generate a random number between 0 and 25 how do i do that?

no dont worry i got it
 
Last edited:

HellVeN

Banned
Joined
Jun 26, 2004
Messages
532
Gender
Male
HSC
2005
Dim IntegerArray(40) As Integer


For i As Integer = 0 To 8

IntegerArray(i) = i

Next i
If you're not sure about the upper bound of the array, use the redim statement to redefine the limits of the array. The Preserve keyword keeps the contents of the array.


Dim IntegerArray() As Integer
Dim i As Integer

For i = 0 To 8
ReDim Preserve IntegerArray(i)
IntegerArray(i) = i
Next i


Remember that this sets 9 numbers (0 to 8).
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Top