By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
432,069 Members | 1,716 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 432,069 IT Pros & Developers. It's quick & easy.

numbers

P: n/a
how can I display a set of numbers like this:
1 2 3 4 5 6 ...
instead of this
1
2
3
4
5
....

Jul 21 '05 #1
Share this Question
Share on Google+
9 Replies


P: n/a
WHat are you trying to display it in?
"freddy" <an*******@discussions.microsoft.com> wrote in message
news:04****************************@phx.gbl...
how can I display a set of numbers like this:
1 2 3 4 5 6 ...
instead of this
1
2
3
4
5
...

Jul 21 '05 #2

P: n/a
numbers from 1 to 50 ---> that way and
1
to
50
that way
-----Original Message-----
WHat are you trying to display it in?
"freddy" <an*******@discussions.microsoft.com> wrote in messagenews:04****************************@phx.gbl...
how can I display a set of numbers like this:
1 2 3 4 5 6 ...
instead of this
1
2
3
4
5
...

.

Jul 21 '05 #3

P: n/a
Where do you want these to appear though, in what control?
"freddy" <an*******@discussions.microsoft.com> wrote in message
news:05****************************@phx.gbl...
numbers from 1 to 50 ---> that way and
1
to
50
that way
-----Original Message-----
WHat are you trying to display it in?
"freddy" <an*******@discussions.microsoft.com> wrote in

message
news:04****************************@phx.gbl...
how can I display a set of numbers like this:
1 2 3 4 5 6 ...
instead of this
1
2
3
4
5
...

.

Jul 21 '05 #4

P: n/a
in a console app.using a for loop
-----Original Message-----
Where do you want these to appear though, in what control?
"freddy" <an*******@discussions.microsoft.com> wrote in messagenews:05****************************@phx.gbl...
numbers from 1 to 50 ---> that way and
1
to
50
that way
>-----Original Message-----
>WHat are you trying to display it in?
>"freddy" <an*******@discussions.microsoft.com> wrote in

message
>news:04****************************@phx.gbl...
>> how can I display a set of numbers like this:
>> 1 2 3 4 5 6 ...
>> instead of this
>> 1
>> 2
>> 3
>> 4
>> 5
>> ...
>>
>
>
>.
>

.

Jul 21 '05 #5

P: n/a
SFB
For to build a single string or line

"freddy" <an*******@discussions.microsoft.com> wrote in message
news:06****************************@phx.gbl...
in a console app.using a for loop
-----Original Message-----
Where do you want these to appear though, in what control?
"freddy" <an*******@discussions.microsoft.com> wrote in

message
news:05****************************@phx.gbl...
numbers from 1 to 50 ---> that way and
1
to
50
that way

>-----Original Message-----
>WHat are you trying to display it in?
>"freddy" <an*******@discussions.microsoft.com> wrote in
message
>news:04****************************@phx.gbl...
>> how can I display a set of numbers like this:
>> 1 2 3 4 5 6 ...
>> instead of this
>> 1
>> 2
>> 3
>> 4
>> 5
>> ...
>>
>
>
>.
>

.

Jul 21 '05 #6

P: n/a
Freddy,
I hope this is not a homework question! ;-)
1
to
50
that way For i As Integer = 1 to 50
Console.WriteLine(i)
Next i
numbers from 1 to 50 ---> that way
For i As Integer = 1 to 50
Console.Write(i)
Console.Write(" "c)
Next i
Console.WriteLine()

Notice in the first one I used WriteLine to cause each item to appear on a
line by itself, where as in the second one I only used Write inside the
loop, and a WriteLine outside to loop to get a single line of output. (of
course the second one will wrap by itself once the line gets past 25
characters ;-))

Hope this helps
Jay
"freddy" <an*******@discussions.microsoft.com> wrote in message
news:06****************************@phx.gbl... in a console app.using a for loop
-----Original Message-----
Where do you want these to appear though, in what control?
"freddy" <an*******@discussions.microsoft.com> wrote in

message
news:05****************************@phx.gbl...
numbers from 1 to 50 ---> that way and
1
to
50
that way

>-----Original Message-----
>WHat are you trying to display it in?
>"freddy" <an*******@discussions.microsoft.com> wrote in
message
>news:04****************************@phx.gbl...
>> how can I display a set of numbers like this:
>> 1 2 3 4 5 6 ...
>> instead of this
>> 1
>> 2
>> 3
>> 4
>> 5
>> ...
>>
>
>
>.
>

.

Jul 21 '05 #7

P: n/a
I just want to understand the code. I think I can use
jagged array,the problem is evertime I do a search it
comes up with c# not vb.net.
-----Original Message-----
Freddy,
I hope this is not a homework question! ;-)
>> 1
>> to
>> 50
>> that way For i As Integer = 1 to 50
Console.WriteLine(i)
Next i
>> numbers from 1 to 50 ---> that way
For i As Integer = 1 to 50
Console.Write(i)
Console.Write(" "c)
Next i
Console.WriteLine()

Notice in the first one I used WriteLine to cause each

item to appear on aline by itself, where as in the second one I only used Write inside theloop, and a WriteLine outside to loop to get a single line of output. (ofcourse the second one will wrap by itself once the line gets past 25characters ;-))

Hope this helps
Jay
"freddy" <an*******@discussions.microsoft.com> wrote in messagenews:06****************************@phx.gbl...
in a console app.using a for loop
>-----Original Message-----
>Where do you want these to appear though, in what control? >"freddy" <an*******@discussions.microsoft.com> wrote in

message
>news:05****************************@phx.gbl...
>> numbers from 1 to 50 ---> that way and
>> 1
>> to
>> 50
>> that way
>>
>> >-----Original Message-----
>> >WHat are you trying to display it in?
>> >"freddy" <an*******@discussions.microsoft.com> wrote in >> message
>> >news:04****************************@phx.gbl...
>> >> how can I display a set of numbers like this:
>> >> 1 2 3 4 5 6 ...
>> >> instead of this
>> >> 1
>> >> 2
>> >> 3
>> >> 4
>> >> 5
>> >> ...
>> >>
>> >
>> >
>> >.
>> >
>
>
>.
>

.

Jul 21 '05 #8

P: n/a
Freddy,
I just want to understand the code. Understand what code, you have not shown any code, you asked how to
"display" something...
I think I can use
jagged array,the problem is evertime I do a search it
comes up with c# not vb.net. Now up until this message you made no mention of an array. My code does not
involve arrays!

What is it you want to do, do you want to print numbers on the console as I
have shown? Or do you have an array question?

Do you want an array with a single column of 50 values?

Dim x(49) As Integer ' remember its high bound, not length

Do you want an array with a single row of 50 values?

Dim x(0,49) As Integer

Do you want a jagged array? (note: VB.NET also refers to jagged arrays as
"Arrays of arrays")

Dim x()() As Integer

For info on arrays in VB.NET see:
http://msdn.microsoft.com/library/de...bconArrays.asp
http://msdn.microsoft.com/library/de...fVBSpec6_8.asp

Or are you asking about something entirely different? ;-)

Hope this helps
Jay
"freddy" <an*******@discussions.microsoft.com> wrote in message
news:08****************************@phx.gbl... I just want to understand the code. I think I can use
jagged array,the problem is evertime I do a search it
comes up with c# not vb.net.
-----Original Message-----
Freddy,
I hope this is not a homework question! ;-)
>> 1
>> to
>> 50
>> that way

For i As Integer = 1 to 50
Console.WriteLine(i)
Next i
>> numbers from 1 to 50 ---> that way

For i As Integer = 1 to 50
Console.Write(i)
Console.Write(" "c)
Next i
Console.WriteLine()

Notice in the first one I used WriteLine to cause each

item to appear on a
line by itself, where as in the second one I only used

Write inside the
loop, and a WriteLine outside to loop to get a single

line of output. (of
course the second one will wrap by itself once the line

gets past 25
characters ;-))

Hope this helps
Jay
"freddy" <an*******@discussions.microsoft.com> wrote in

message
news:06****************************@phx.gbl...
in a console app.using a for loop
>-----Original Message-----
>Where do you want these to appear though, in what control? >"freddy" <an*******@discussions.microsoft.com> wrote in
message
>news:05****************************@phx.gbl...
>> numbers from 1 to 50 ---> that way and
>> 1
>> to
>> 50
>> that way
>>
>> >-----Original Message-----
>> >WHat are you trying to display it in?
>> >"freddy" <an*******@discussions.microsoft.com> wrote in >> message
>> >news:04****************************@phx.gbl...
>> >> how can I display a set of numbers like this:
>> >> 1 2 3 4 5 6 ...
>> >> instead of this
>> >> 1
>> >> 2
>> >> 3
>> >> 4
>> >> 5
>> >> ...
>> >>
>> >
>> >
>> >.
>> >
>
>
>.
>

.

Jul 21 '05 #9

P: n/a
Both websites are very helpful
-----Original Message-----
in a console app.using a for loop
-----Original Message-----
Where do you want these to appear though, in what control?"freddy" <an*******@discussions.microsoft.com> wrote in

message
news:05****************************@phx.gbl...
numbers from 1 to 50 ---> that way and
1
to
50
that way

>-----Original Message-----
>WHat are you trying to display it in?
>"freddy" <an*******@discussions.microsoft.com> wrote in message
>news:04****************************@phx.gbl...
>> how can I display a set of numbers like this:
>> 1 2 3 4 5 6 ...
>> instead of this
>> 1
>> 2
>> 3
>> 4
>> 5
>> ...
>>
>
>
>.
>

.

.

Jul 21 '05 #10

This discussion thread is closed

Replies have been disabled for this discussion.