Click here to Skip to main content
15,914,905 members

Comments by ATeDe (Top 10 by date)

ATeDe 18-Mar-18 17:33pm View    
Hey Maciej, Instead asking funny questions help, dear man, to improve solution ...Can't you see that is far from perfect?

Module Module1
' emulate the TextBox/ Label array as in the version VB6
Public txtBox() As TextBox = {Form1.TextBox1, Form1.TextBox2, Form1.TextBox3, Form1.TextBox4, Form1.TextBox5, Form1.TextBox6, Form1.TextBox7}
Public myLabel() As Label = {Form1.Label1, Form1.Label2, Form1.Label3, Form1.Label4, Form1.Label5, Form1.Label6, Form1.Label7}
Public Phones As String() = {"1234567xx", "123456xxx", "", "123456789", "987654321", "0", "PhoneNumber"}
End Module

Then....

Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load

Dim i As Integer
For Each lbl In myLabel
myLabel(i).Text = "Customer" & String.Format(i + 1)
i += 1
Next

End Sub
ATeDe 18-Mar-18 17:32pm View    
Deleted
Hey Maciej, Instead asking fanny questions help, dear man, to improve solution ...Can't you see that is far from perfect?

Module Module1
' emulate the TextBox/ Label array as in the version VB6
Public txtBox() As TextBox = {Form1.TextBox1, Form1.TextBox2, Form1.TextBox3, Form1.TextBox4, Form1.TextBox5, Form1.TextBox6, Form1.TextBox7}
Public myLabel() As Label = {Form1.Label1, Form1.Label2, Form1.Label3, Form1.Label4, Form1.Label5, Form1.Label6, Form1.Label7}
Public Phones As String() = {"1234567xx", "123456xxx", "", "123456789", "987654321", "0", "PhoneNumber"}
End Module

Then....

Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load

Dim i As Integer
For Each lbl In myLabel
myLabel(i).Text = "Customer" & String.Format(i + 1)
i += 1
Next

End Sub
ATeDe 18-Mar-18 17:28pm View    
Deleted
Hey Maciej, Instead asking fanny questions help, dear man, to improve solution ...Can't you see that is far from perfect?

Module Module1
' emulate the TextBox/ Label array as in the version VB6
Public txtBox() As TextBox = {Form1.TextBox1, Form1.TextBox2, Form1.TextBox3, Form1.TextBox4, Form1.TextBox5, Form1.TextBox6, Form1.TextBox7}
Public myLabel() As Label = {Form1.Label1, Form1.Label2, Form1.Label3, Form1.Label4, Form1.Label5, Form1.Label6, Form1.Label7}
Public Phones As String() = {"1234567xx", "123456xxx", "", "123456789", "987654321", "0", "PhoneNumber"}
End Module

Than....

Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load

Dim i As Integer
For Each lbl In myLabel
myLabel(i).Text = "Customer" & String.Format(i + 1)
i += 1
Next

End Sub
ATeDe 14-Mar-18 20:17pm View    
Thanks Maciej for your solution, which obviously works well, despite small 'hiccup' in the beginning, as my VB.NET compiler (VS2017) does not like 1st line of code:

Dim lines() As String = File.ReadAllLines(CSVfile).ToList() complaining
Error BC30311 Value of type 'List(Of String)' cannot be converted to 'String()'

After changing to
Dim lines() As String = File.ReadAllLines(CSVfile) the code executes smoothly

Another think to notice is that, it takes approx 10% longer to convert my CSV file (10 columns, 131745 records)

Thank you!


Original code elapsed time: 3490.86 Milliseconds
->Unformatted table: Count= 131745
A,B,C,D,E,F,G,H,I,J
2014,26,00001,1,01,900001,150,150,0,1412
2014,26,00001,1,01,905111,3500,3500,0,1412
2014,26,00001,1,01,907213,60,0,60,1412
2014,26,00002,1,01,900001,250,250,0,1827
..................

New routine elapsed time: 3763.66 Milliseconds
->Unformatted table: Count= 131745
A,B,C,D,E,F,G,H,I,J
2014,26,00001,1,01,900001,150,150,0,1412
2014,26,00001,1,01,905111,3500,3500,0,1412
2014,26,00001,1,01,907213,60,0,60,1412
2014,26,00002,1,01,900001,250,250,0,1827
..................
ATeDe 8-Feb-18 17:39pm View    
Yeah, and instead of using Dim A As String(), listA might be created directly, and then we got very neat statement:

Dim C = listA.Where(Function(x) B.Contains(x.Key))
For Each item In C
Console.WriteLine("{0} {1}", item.Key, item.Value)
Next