473,322 Members | 1,911 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

Array and console.writeline

Can someone help me?
Im trying to use console.writeline with ciag1.
Application must read string, split it by "," and show every section between
",".

Dim serwery_split()
Dim elementy As String()
Dim tablica(0)
Dim i As Integer = 0
Dim ciag1 = "a,b,c,d,e,f"

For i = 0 To tablica(i).lenght - 1
ReDim Preserve tablica(i)
tablica(i) = ciag1.Split(",")(0)
Console.WriteLine(tablica(i))
i = i + 1
Next
Nov 21 '05 #1
4 2040
Hi,

Try this.

Dim tablica() As String
Dim i As Integer = 0
Dim ciag1 As String = "a,b,c,d,e,f"
tablica = ciag1.Split(","c)

For i = 0 To tablica.GetUpperBound(0)
Console.WriteLine(tablica(i))
Next

'or you can use a for each loop

For Each s As String In tablica
Console.WriteLine(s)
Next
Ken
-------------------------

"Leszek" <ma***@zegarek.com> wrote in message
news:e9*************@tk2msftngp13.phx.gbl...
Can someone help me?
Im trying to use console.writeline with ciag1.
Application must read string, split it by "," and show every section between
",".

Dim serwery_split()
Dim elementy As String()
Dim tablica(0)
Dim i As Integer = 0
Dim ciag1 = "a,b,c,d,e,f"

For i = 0 To tablica(i).lenght - 1
ReDim Preserve tablica(i)
tablica(i) = ciag1.Split(",")(0)
Console.WriteLine(tablica(i))
i = i + 1
Next

Nov 21 '05 #2
Thanks! That's it!

I have one more problem...
"a,b,c,d,e,f" are name of servers. I need to run Sub for every server from
this table.
But there is something wrong with execute it...
How should it looks?
example:

Sub main
Dim tablica() As String
Dim i As Integer = 0
Dim ciag1 As String = "a,b,c,d,e,f"
tablica = ciag1.Split(","c)

For i = 0 To tablica.GetUpperBound(0)
check(tablica(i))
Next
End Sub

Sub check(ByVal tablica(i) as string)
Console.WriteLine(tablica(i))
End Sub

Użytkownik "Ken Tucker [MVP]" <vb***@bellsouth.net> napisał w wiadomo¶ci
news:ei**************@TK2MSFTNGP15.phx.gbl...
Hi,

Try this.

Dim tablica() As String
Dim i As Integer = 0
Dim ciag1 As String = "a,b,c,d,e,f"
tablica = ciag1.Split(","c)

For i = 0 To tablica.GetUpperBound(0)
Console.WriteLine(tablica(i))
Next

'or you can use a for each loop

For Each s As String In tablica
Console.WriteLine(s)
Next
Ken
-------------------------

"Leszek" <ma***@zegarek.com> wrote in message
news:e9*************@tk2msftngp13.phx.gbl...
Can someone help me?
Im trying to use console.writeline with ciag1.
Application must read string, split it by "," and show every section
between
",".

Dim serwery_split()
Dim elementy As String()
Dim tablica(0)
Dim i As Integer = 0
Dim ciag1 = "a,b,c,d,e,f"

For i = 0 To tablica(i).lenght - 1
ReDim Preserve tablica(i)
tablica(i) = ciag1.Split(",")(0)
Console.WriteLine(tablica(i))
i = i + 1
Next

Nov 21 '05 #3
Hi,

You do not need to use the same name in the sub routine. You were
passing an array to the procedure when you only needed a string. Try this
instead

Sub check(ByVal strIn as string)
Console.WriteLine(strIn)
End Sub

Ken
--------------------
"Leszek" <ma***@zegarek.com> wrote in message
news:%2****************@TK2MSFTNGP15.phx.gbl...
Thanks! That's it!

I have one more problem...
"a,b,c,d,e,f" are name of servers. I need to run Sub for every server from
this table.
But there is something wrong with execute it...
How should it looks?
example:

Sub main
Dim tablica() As String
Dim i As Integer = 0
Dim ciag1 As String = "a,b,c,d,e,f"
tablica = ciag1.Split(","c)

For i = 0 To tablica.GetUpperBound(0)
check(tablica(i))
Next
End Sub

Sub check(ByVal tablica(i) as string)
Console.WriteLine(tablica(i))
End Sub

Użytkownik "Ken Tucker [MVP]" <vb***@bellsouth.net> napisał w wiadomo¶ci
news:ei**************@TK2MSFTNGP15.phx.gbl...
Hi,

Try this.

Dim tablica() As String
Dim i As Integer = 0
Dim ciag1 As String = "a,b,c,d,e,f"
tablica = ciag1.Split(","c)

For i = 0 To tablica.GetUpperBound(0)
Console.WriteLine(tablica(i))
Next

'or you can use a for each loop

For Each s As String In tablica
Console.WriteLine(s)
Next
Ken
-------------------------

"Leszek" <ma***@zegarek.com> wrote in message
news:e9*************@tk2msftngp13.phx.gbl...
Can someone help me?
Im trying to use console.writeline with ciag1.
Application must read string, split it by "," and show every section
between
",".

Dim serwery_split()
Dim elementy As String()
Dim tablica(0)
Dim i As Integer = 0
Dim ciag1 = "a,b,c,d,e,f"

For i = 0 To tablica(i).lenght - 1
ReDim Preserve tablica(i)
tablica(i) = ciag1.Split(",")(0)
Console.WriteLine(tablica(i))
i = i + 1
Next


Nov 21 '05 #4
Thanks for explaining me rules about arrays :)
Now i know how to use it :)

Użytkownik "Ken Tucker [MVP]" <vb***@bellsouth.net> napisał w wiadomo¶ci
news:O3**************@TK2MSFTNGP12.phx.gbl...
Hi,

You do not need to use the same name in the sub routine. You were
passing an array to the procedure when you only needed a string. Try this
instead

Sub check(ByVal strIn as string)
Console.WriteLine(strIn)
End Sub

Ken
--------------------
"Leszek" <ma***@zegarek.com> wrote in message
news:%2****************@TK2MSFTNGP15.phx.gbl...
Thanks! That's it!

I have one more problem...
"a,b,c,d,e,f" are name of servers. I need to run Sub for every server from
this table.
But there is something wrong with execute it...
How should it looks?
example:

Sub main
Dim tablica() As String
Dim i As Integer = 0
Dim ciag1 As String = "a,b,c,d,e,f"
tablica = ciag1.Split(","c)

For i = 0 To tablica.GetUpperBound(0)
check(tablica(i))
Next
End Sub

Sub check(ByVal tablica(i) as string)
Console.WriteLine(tablica(i))
End Sub

Użytkownik "Ken Tucker [MVP]" <vb***@bellsouth.net> napisał w wiadomo¶ci
news:ei**************@TK2MSFTNGP15.phx.gbl...
Hi,

Try this.

Dim tablica() As String
Dim i As Integer = 0
Dim ciag1 As String = "a,b,c,d,e,f"
tablica = ciag1.Split(","c)

For i = 0 To tablica.GetUpperBound(0)
Console.WriteLine(tablica(i))
Next

'or you can use a for each loop

For Each s As String In tablica
Console.WriteLine(s)
Next
Ken
-------------------------

"Leszek" <ma***@zegarek.com> wrote in message
news:e9*************@tk2msftngp13.phx.gbl...
Can someone help me?
Im trying to use console.writeline with ciag1.
Application must read string, split it by "," and show every section
between
",".

Dim serwery_split()
Dim elementy As String()
Dim tablica(0)
Dim i As Integer = 0
Dim ciag1 = "a,b,c,d,e,f"

For i = 0 To tablica(i).lenght - 1
ReDim Preserve tablica(i)
tablica(i) = ciag1.Split(",")(0)
Console.WriteLine(tablica(i))
i = i + 1
Next


Nov 21 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: jmrieman | last post by:
first off, I am an IT pro trying to dust off the cobwebs of programming in a Master degree program so please be nice:) I am trying to pass a system.array object by reference to a procedure (or...
1
by: Darsin | last post by:
Hi all, I am a new programmer to C# and i am having a following problem. I want to make a single method which takes a variable length array and display it contents. i have defined the method as:...
4
by: sal | last post by:
Greets, All Converting array formula to work with datatables/dataset tia sal I finally completed a formula I was working on, see working code below. I would like to change this code so it...
11
by: Al | last post by:
This statement returns a -1, indicating "not found": Find1 = Array.IndexOf(FilesArray, "sa001") But IndexOf on a specific item in that array returns a value of 26: Find1 =...
4
by: Rich | last post by:
Dim bNcd, bNcm, bNqa, bNcur, bN0, bN1, bN2, bN3, bN4 As Boolean Dim arrBool As Boolean() = {bNcd, bNcm, bNqa, bNcur, bN0, bN1, bN2, bN3, bN4} Dim i As Integer bNcd = True bNcm = True bNqa =...
1
by: cyrvb | last post by:
Hello, I'm a very very newbie in C# I did start 2 days ago, I get Visual Stuido 2005 C# I try to understand how to manage the arrays I did write this
20
by: John Mark Howell | last post by:
I had a customer call about some C# code they had put together that was handling some large arrays. The performance was rather poor. The C# code runs in about 22 seconds and the equivalent...
8
by: per9000 | last post by:
Hi all, I have a two-dimensional array of data, f.x int's. We can imagine that the array is "really large". Now I want the data in it and store this in a one-dimensional array. The obvious...
0
by: dans | last post by:
I want to serialise an array of structs into a MemoryStream so I can pass the contents in a message. I have written something that will Serialize and Deserialize in individual object. Is there a...
2
by: raylopez99 | last post by:
Here is a short program demonstrating using IEnumberable, Linq, predicates, extension methods and some tricks and how to convert an IEnumberable sequence into an array. For future reference, not...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.