Ir para conteúdo

Arquivado

Este tópico foi arquivado e está fechado para novas respostas.

drapn

[Resolvido] Datagridview populado lentidão

Recommended Posts

Boa tarde pessoal

Estou com um projeto em Vb.Net que consiste em importar dados de uma planilha de Excel para um Datagridview.

O projeto esta funcionando tudo ok porem notei que quando vou movendo as barras laterais e inferiores o formulário apresenta grande lentidão para mover as colunas etc...

Fiz o teste criando um projeto novo com somente 1 Form, 1 Datagrid e 1Botão e os códigos para fazer a importação e quando eu "populo" o datagridview com o conteudo ele apresenta esses legs.

 

Alguem a ja passou por isso?

Será que é configuração da máquina? (Não é uma máquina tão fraca)

O Vb.NET é a versão 2015

 

 

Os arquivos de Excel variam de 80 Linhas por 5 Colunas á 400 linhas e 5 colunas

 

O código é esse:

 

Sub ImportaEstoque()
        Dim Local
        Local = EndArquivo()

        If String.IsNullOrWhiteSpace(Local) Then
            MessageBox.Show("Nenhum arquivo foi selecionado.", "Informação.", MessageBoxButtons.OK, MessageBoxIcon.Information)
            Return
        End If

        '------------------------------
        Dim caminhoArquivoExcel As String = Local
        Dim nomePlanilhaExcel As String = "ESTQ" & "$"
        Dim conexaoOleDb As OleDbConnection = Nothing
        Dim ds As DataSet
        Dim cmd As OleDbDataAdapter
        '------------------------------

        Try
            'conexaoOleDb = New OleDbConnection("provider=Microsoft.Jet.OLEDB.4.0;Data Source= " & Local & ";Extended Properties=Excel 8.0;")
            conexaoOleDb = New OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source= " & Local & ";Extended Properties='Excel 8.0;HDR=Yes'")

            'cmd = New OleDbDataAdapter("Select * from [" & nomePlanilhaExcel & "]", conexaoOleDb)

            cmd = New OleDbDataAdapter("Select * from [" & nomePlanilhaExcel & "]  Where UM Like '%" & "PC" & "%'", conexaoOleDb)

            cmd.TableMappings.Add("Table", "tabelaExcel")
            ds = New DataSet
            cmd.Fill(ds)
            dgvDados.DataSource = ds.Tables(0)
        Catch ex As Exception
            MessageBox.Show(ex.ToString, "Erro", MessageBoxButtons.OK, MessageBoxIcon.Error)
        Finally
            conexaoOleDb.Close()
        End Try

        sbQtdItens.Text = "Encontrados " & dgvDados.RowCount.ToString & " itens."

    End Sub

 

 

 

Pessoal desde já muito obrigado pela força!

Compartilhar este post


Link para o post
Compartilhar em outros sites

Boa tarde a todos,

Gostaria de postar aqui a solução de meu problema.

O tratamento no datagridview teve uma melhora de desempenho de mais de 100% usando o código abaixo que permite fazer os filtros de forma "offline".

Vou postar a fonte e o código para que outras pessoas com a mesma dificuldade.

 

dim bs as new bindingsource

bs.datasource = datagrivview1.datasource

bs.filter = "codigo like '" & txtbox.text & "'

datagrivdiew1.datasource = bs.datasource


 

Abaixo segue o post original do autor

https://social.msdn.microsoft.com/Forums/sqlserver/pt-BR/2811c32d-8b2c-4b62-a2c1-29ee9f4b9016/filtrando-em-datagridview-sem-conexo-com-banco-de-dados?forum=vscsharppt&prof=required

Compartilhar este post


Link para o post
Compartilhar em outros sites

  • Conteúdo Similar

    • Por igadino
      Bom dia pessoal, convertir essa função do C# para vba ele funciona perfeitamento no excel e access
      porem estou tentendo usar ela no vb.net  editor VISUAL STUDIO 2013, aparece o erro conforme a imagem enexo, alguem consegue corrigir esse erro;
      Function crc_ccitt_ffff(strParam As String) As String
              Const CRC_POLY_CCITT As Long = &H1021&
              Const CRC_START_CCITT_FFFF As Long = &HFFFF&
              Dim crc As Long, b() As Byte, c As Long, i As Long, j As Long
              Dim crc_tabccitt(0 To 255) As Long
              For i = 0 To 255
                  crc = 0
                  c = i * 256
                  For j = 0 To 7
                      If (crc Xor c) And 32768 Then
                          crc = (crc * 2) Xor CRC_POLY_CCITT
                      Else
                          crc = crc * 2
                      End If
                      c = c * 2
                  Next j
                  crc_tabccitt(i) = crc
              Next i
                  b = strParam
              crc = CRC_START_CCITT_FFFF
              For i = 0 To UBound(b) Step 2
                  crc = (crc * 256) Xor crc_tabccitt(((crc \ 256) Xor b(i)) And 255)
                  crc = ((crc \ 65536) * 65536) Xor crc
              Next i
              crc_ccitt_ffff = Hex(crc)
          End Function

    • Por carol2906
      Meu notebook está bem lento desde que o emprestei para meu filho jogar. Não sei o que fazer.
      Segue o log do Hijack
       
      Logfile of Trend Micro HijackThis v2.0.4
      Scan saved at 11:12:03, on 07/10/2019
      Platform: Unknown Windows (WinNT 6.02.1008)
      MSIE: Internet Explorer v11.0 (11.00.17763.0592)

      Boot mode: Normal
      Running processes:
      C:\Program Files (x86)\Lenovo\iMController\PluginHost\Lenovo.Modern.ImController.PluginHost.CompanionApp.exe
      C:\Users\kaka2\AppData\Local\Microsoft\OneDrive\OneDrive.exe
      C:\Program Files (x86)\Lenovo\iMController\PluginHost\Lenovo.Modern.ImController.PluginHost.SettingsApp.exe
      C:\Program Files (x86)\Lenovo\iMController\PluginHost\Lenovo.Modern.ImController.PluginHost.Device.exe
      C:\Users\kaka2\HijackThis.exe
      R1 - HKCU\Software\Microsoft\Internet Explorer\Main,Default_Page_URL = http://lenovo17win10.msn.com/?pc=LCTE
      R1 - HKCU\Software\Microsoft\Internet Explorer\Main,Search Page = http://go.microsoft.com/fwlink/?LinkId=54896
      R0 - HKCU\Software\Microsoft\Internet Explorer\Main,Start Page = http://lenovo17win10.msn.com/?pc=LCTE
      R1 - HKLM\Software\Microsoft\Internet Explorer\Main,Default_Page_URL = http://go.microsoft.com/fwlink/p/?LinkId=255141
      R1 - HKLM\Software\Microsoft\Internet Explorer\Main,Default_Search_URL = http://go.microsoft.com/fwlink/?LinkId=54896
      R1 - HKLM\Software\Microsoft\Internet Explorer\Main,Search Page = http://go.microsoft.com/fwlink/?LinkId=54896
      R0 - HKLM\Software\Microsoft\Internet Explorer\Main,Start Page = http://go.microsoft.com/fwlink/p/?LinkId=255141
      R0 - HKLM\Software\Microsoft\Internet Explorer\Search,SearchAssistant = 
      R0 - HKLM\Software\Microsoft\Internet Explorer\Search,CustomizeSearch = 
      R0 - HKCU\Software\Microsoft\Internet Explorer\Main,Local Page = %11%\blank.htm
      R0 - HKLM\Software\Microsoft\Internet Explorer\Main,Local Page = C:\Windows\SysWOW64\blank.htm
      R0 - HKCU\Software\Microsoft\Internet Explorer\Toolbar,LinksFolderName = 
      F2 - REG:system.ini: UserInit=
      O4 - HKCU\..\Run: [OneDrive] "C:\Users\kaka2\AppData\Local\Microsoft\OneDrive\OneDrive.exe" /background
      O11 - Options group: [ACCELERATED_GRAPHICS] Accelerated graphics
      O18 - Protocol: tbauth - {14654CA6-5711-491D-B89A-58E571679951} - C:\Windows\SysWOW64\tbauth.dll
      O18 - Protocol: windows.tbauth - {14654CA6-5711-491D-B89A-58E571679951} - C:\Windows\SysWOW64\tbauth.dll
      O23 - Service: Adobe Acrobat Update Service (AdobeARMservice) - Adobe Systems - C:\Program Files (x86)\Common Files\Adobe\ARM\1.0\armsvc.exe
      O23 - Service: @%SystemRoot%\system32\Alg.exe,-112 (ALG) - Unknown owner - C:\Windows\System32\alg.exe (file missing)
      O23 - Service: Intel(R) Content Protection HECI Service (cphs) - Intel Corporation - C:\Windows\System32\DriverStore\FileRepository\iigd_dch.inf_amd64_c59c7d36072c06c5\IntelCpHeciSvc.exe
      O23 - Service: Intel(R) Content Protection HDCP Service (cplspcon) - Intel Corporation - C:\Windows\System32\DriverStore\FileRepository\iigd_dch.inf_amd64_c59c7d36072c06c5\IntelCpHDCPSvc.exe
      O23 - Service: @%SystemRoot%\system32\DiagSvcs\DiagnosticsHub.StandardCollector.ServiceRes.dll,-1000 (diagnosticshub.standardcollector.service) - Unknown owner - C:\Windows\system32\DiagSvcs\DiagnosticsHub.StandardCollector.Service.exe (file missing)
      O23 - Service: Dolby DAX2 API Service - Dolby Laboratories, Inc. - C:\Program Files\Dolby\Dolby DAX2\DAX2_API\DolbyDAX2API.exe
      O23 - Service: @%SystemRoot%\system32\efssvc.dll,-100 (EFS) - Unknown owner - C:\Windows\System32\lsass.exe (file missing)
      O23 - Service: @%systemroot%\system32\fxsresm.dll,-118 (Fax) - Unknown owner - C:\Windows\system32\fxssvc.exe (file missing)
      O23 - Service: Google Chrome Elevation Service (GoogleChromeElevationService) - Google LLC - C:\Program Files (x86)\Google\Chrome\Application\77.0.3865.90\elevation_service.exe
      O23 - Service: Serviço do Google Update (gupdate) (gupdate) - Google LLC - C:\Program Files (x86)\Google\Update\GoogleUpdate.exe
      O23 - Service: Serviço do Google Update (gupdatem) (gupdatem) - Google LLC - C:\Program Files (x86)\Google\Update\GoogleUpdate.exe
      O23 - Service: Intel(R) HD Graphics Control Panel Service (igfxCUIService2.0.0.0) - Intel Corporation - C:\Windows\System32\DriverStore\FileRepository\cui_dch.inf_amd64_a7428663aca90897\igfxCUIService.exe
      O23 - Service: @oem3.inf,%ImcSvcDisplayName%;System Interface Foundation Service (ImControllerService) - Lenovo Group Ltd. - C:\Program Files\Lenovo\ImController\Service\Lenovo.Modern.ImController.exe
      O23 - Service: @oem10.inf,%SocketHECIServiceName%;Intel(R) Capability Licensing Service TCP IP Interface (Intel(R) Capability Licensing Service TCP IP Interface) - Unknown owner - C:\Windows\System32\Intel\iCLS Client\lib\SocketHeciServer.exe (file missing)
      O23 - Service: @oem10.inf,%TPMProvisioningServiceName%;Intel(R) TPM Provisioning Service (Intel(R) TPM Provisioning Service) - Unknown owner - C:\Windows\System32\Intel\iCLS Client\lib\TPMProvisioningService.exe (file missing)
      O23 - Service: Intel(R) Dynamic Application Loader Host Interface Service (jhi_service) - Unknown owner - C:\Windows\System32\jhi_service.exe (file missing)
      O23 - Service: @keyiso.dll,-100 (KeyIso) - Unknown owner - C:\Windows\system32\lsass.exe (file missing)
      O23 - Service: McSecDashboardService - McAfee, Inc. - C:\Program Files\McAfeeDashboard\McSecDashboardService.exe
      O23 - Service: @comres.dll,-2797 (MSDTC) - Unknown owner - C:\Windows\System32\msdtc.exe (file missing)
      O23 - Service: @%SystemRoot%\System32\netlogon.dll,-102 (Netlogon) - Unknown owner - C:\Windows\system32\lsass.exe (file missing)
      O23 - Service: @%systemroot%\system32\PerceptionSimulation\PerceptionSimulationService.exe,-101 (perceptionsimulation) - Unknown owner - C:\Windows\system32\PerceptionSimulation\PerceptionSimulationService.exe (file missing)
      O23 - Service: @%systemroot%\system32\Locator.exe,-2 (RpcLocator) - Unknown owner - C:\Windows\system32\locator.exe (file missing)
      O23 - Service: Realtek Audio Service (RtkAudioService) - Realtek Semiconductor - C:\Program Files\Realtek\Audio\HDA\RtkAudioService64.exe
      O23 - Service: @%SystemRoot%\system32\samsrv.dll,-1 (SamSs) - Unknown owner - C:\Windows\system32\lsass.exe (file missing)
      O23 - Service: @%systemroot%\system32\SecurityHealthAgent.dll,-1002 (SecurityHealthService) - Unknown owner - C:\Windows\system32\SecurityHealthService.exe (file missing)
      O23 - Service: @%SystemRoot%\system32\SensorDataService.exe,-101 (SensorDataService) - Unknown owner - C:\Windows\System32\SensorDataService.exe (file missing)
      O23 - Service: @%SystemRoot%\System32\SgrmBroker.exe,-100 (SgrmBroker) - Unknown owner - C:\Windows\system32\SgrmBroker.exe (file missing)
      O23 - Service: @firewallapi.dll,-50323 (SNMPTRAP) - Unknown owner - C:\Windows\System32\snmptrap.exe (file missing)
      O23 - Service: @%systemroot%\system32\spectrum.exe,-101 (spectrum) - Unknown owner - C:\Windows\system32\spectrum.exe (file missing)
      O23 - Service: @%systemroot%\system32\spoolsv.exe,-1 (Spooler) - Unknown owner - C:\Windows\System32\spoolsv.exe (file missing)
      O23 - Service: @%SystemRoot%\system32\sppsvc.exe,-101 (sppsvc) - Unknown owner - C:\Windows\system32\sppsvc.exe (file missing)
      O23 - Service: @oem41.inf,%SynTPEnhService.SVCDESC%;SynTPEnhService (SynTPEnhService) - Unknown owner - C:\Windows\System32\SynTPEnhService.exe (file missing)
      O23 - Service: @%SystemRoot%\system32\TieringEngineService.exe,-702 (TieringEngineService) - Unknown owner - C:\Windows\system32\TieringEngineService.exe (file missing)
      O23 - Service: @%SystemRoot%\system32\vaultsvc.dll,-1003 (VaultSvc) - Unknown owner - C:\Windows\system32\lsass.exe (file missing)
      O23 - Service: @%SystemRoot%\system32\vds.exe,-100 (vds) - Unknown owner - C:\Windows\System32\vds.exe (file missing)
      O23 - Service: @%systemroot%\system32\vssvc.exe,-102 (VSS) - Unknown owner - C:\Windows\system32\vssvc.exe (file missing)
      O23 - Service: @%systemroot%\system32\wbengine.exe,-104 (wbengine) - Unknown owner - C:\Windows\system32\wbengine.exe (file missing)
      O23 - Service: @%Systemroot%\system32\wbem\wmiapsrv.exe,-110 (wmiApSrv) - Unknown owner - C:\Windows\system32\wbem\WmiApSrv.exe (file missing)
      O23 - Service: @%PROGRAMFILES%\Windows Media Player\wmpnetwk.exe,-101 (WMPNetworkSvc) - Unknown owner - C:\Program Files (x86)\Windows Media Player\wmpnetwk.exe (file missing)
      --
      End of file - 8248 bytes
       
       
    • Por Estevão Alves Avelino
      Estou com duvidas de como pegar os dados digitados no DataGridView e jogar dentro de variáveis, se alguém souber uma maneira de fazer isso ficarei muito grato!
    • Por Roberto S. Santos
      Boa noite.
      Alguém pode me ajudar a fazer a conexão pra salvar Id, UserID e o nome da pessoa ?
      Bdados : cadastro
      Tabela : usuario
      Sem senha : root somente.
      Des de já agradeço.
    • Por Roberto S. Santos
      Boa noite amigos programadores.
      Como posso salvar os dados do tracker.dat no MySQL ?
      Dados : textbox1.text
      Estou usando vb.net 
      Queria uma tabela no MySQL usando o Wamp .
      Poderiam me ajudar ?
      Obrigado.
×

Informação importante

Ao usar o fórum, você concorda com nossos Termos e condições.