How load fast Excell file to listview?
How load fast Excell file to listview?
How load fast Excell file to listview?
How load fast Excell file to listview?
How load fast Excell file to listview?
How load fast Excell file to listview? How load fast Excell file to listview? How load fast Excell file to listview? How load fast Excell file to listview? How load fast Excell file to listview? How load fast Excell file to listview? How load fast Excell file to listview? How load fast Excell file to listview?
How load fast Excell file to listview? How load fast Excell file to listview?
How load fast Excell file to listview?
Go Back  Xtreme Visual Basic Talk > > > How load fast Excell file to listview?


Reply
 
Thread Tools Display Modes
  #1  
Old 05-14-2015, 04:48 PM
Andres128 Andres128 is offline
Newcomer
 
Join Date: May 2015
Posts: 1
Question How load fast Excell file to listview?


Hello friends this respected forum!

I have a problem is that I have an excel file with 10,000 rows, like this:

Hello friends this respected forum! :thumb::thumb::thumb:

I have a problem is that I have an excel file with 10,000 rows, like this:

Code:
F1 B1 D1
aa bb cc
I have this code, it works but it is slow to load in a listview, you could help me improve my code, I really appreciate what I have tried many ways and I can not get it to load faster.

Code:
Dim oExcel As Object = CreateObject("Excel.Application")
Dim oBook As Object = oExcel.Workbooks.Open(mypatch)
Dim oSheet As Object = oBook.Worksheets(1)
Dim range As Excel.Range = oSheet.UsedRange
Dim number As Integer
Dim celd_B, celd_D, celd_F As String
Me.Cursor = Cursors.WaitCursor

For i = 1 To range.Rows.Count

number = i + 1
celd_B = oSheet.Range("B" & number).Value
celd_D = oSheet.Range("D" & number).Value
celd_F = oSheet.Range("F" & number).Value

If Not celd_B = "" And Not celd_D = "" And Not celd_F = "" And celd_D >= 1000 Then

result.Text += celd_B & "#" & celd_D & "#" & celd_F & "#" & vbNewLine 'PROBLEM HERE SLOW LOAD :(
               

End If
Next


result.Text = result.Text.TrimEnd

'Show listview:
Dim items() As ListViewItem = (From line In result.Lines _
                                 Select New ListViewItem(line.Split("#"c))).ToArray
            ListadoView.Items.AddRange(items)
No more thank you very much for your time and for helping to solve this problem.

Bye and greetings brothers
Reply With Quote
  #2  
Old 05-18-2015, 03:38 AM
Flyguy's Avatar
FlyguyHow load fast Excell file to listview? Flyguy is offline
Lost Soul

Super Moderator
* Guru *
 
Join Date: May 2001
Location: Vorlon
Posts: 19,165
Default

Why do you first build a big text string?
Why not add every line to the listview directly??
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
How load fast Excell file to listview?
How load fast Excell file to listview?
How load fast Excell file to listview? How load fast Excell file to listview?
How load fast Excell file to listview?
How load fast Excell file to listview?
How load fast Excell file to listview? How load fast Excell file to listview? How load fast Excell file to listview? How load fast Excell file to listview? How load fast Excell file to listview? How load fast Excell file to listview? How load fast Excell file to listview?
How load fast Excell file to listview?
How load fast Excell file to listview?
 
How load fast Excell file to listview?
How load fast Excell file to listview?
 
-->