455,033 Members | 1,285 Online
Need help? Post your question and get tips & solutions from a community of 455,033 IT Pros & Developers. It's quick & easy.

Converting an array from integer to string

 P: n/a Hi All, How to convert a one dimensional integer array to a one dimensional array of type string? kd Nov 21 '05 #1
6 Replies

 P: n/a Hi, You have to manually convert it. Dim arInt(10) As Integer Dim arStr() As String ReDim arStr(arInt.GetUpperBound(0)) For x As Integer = 0 To arInt.GetUpperBound(0) arInt(x) = x Next For y As Integer = 0 To arInt.GetUpperBound(0) arStr(y) = arInt(y).ToString Next Ken --------------- "kd" wrote in message news:55**********************************@microsof t.com... Hi All, How to convert a one dimensional integer array to a one dimensional array of type string? kd Nov 21 '05 #2

 P: n/a Thanks Ken. Regards, kd. "Ken Tucker [MVP]" wrote: Hi, You have to manually convert it. Dim arInt(10) As Integer Dim arStr() As String ReDim arStr(arInt.GetUpperBound(0)) For x As Integer = 0 To arInt.GetUpperBound(0) arInt(x) = x Next For y As Integer = 0 To arInt.GetUpperBound(0) arStr(y) = arInt(y).ToString Next Ken --------------- "kd" wrote in message news:55**********************************@microsof t.com... Hi All, How to convert a one dimensional integer array to a one dimensional array of type string? kd Nov 21 '05 #3

 P: n/a "Ken Tucker [MVP]" schrieb: Dim arStr() As String ReDim arStr(arInt.GetUpperBound(0)) Why not just 'Dim arStr(arInt.GetUpperBound(0)) As String'? :-) -- M S Herfried K. Wagner M V P V B Nov 21 '05 #4

 P: n/a Why not just 'Dim arStr(arInt.GetUpperBound(0)) As String'? Why not just dim arStr(arInt.Lenght) as String? After 2 minutes looking at it, I saw that that was the only improvement you did. :-) Cor Nov 21 '05 #5

 P: n/a "Cor Ligthert" schrieb: Why not just 'Dim arStr(arInt.GetUpperBound(0)) As String'? Why not just dim arStr(arInt.Lenght) as String? Because it will create an array that has 'Length' + 1 elements, which is not desired. -- M S Herfried K. Wagner M V P V B Nov 21 '05 #6

 P: n/a Herfried, Why not just 'Dim arStr(arInt.GetUpperBound(0)) As String'? Why not just dim arStr(arInt.Lenght) as String? Because it will create an array that has 'Length' + 1 elements, which is not desired. I have a great tip for you. Why not just dim arStr(arInt.Lenght - 1) as String? I forgot that - 1, I would have expected from you that you had seen this, however I like those answers as you give now. Makes me smilling. :-) Cor Nov 21 '05 #7