Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. Delay in Listview Binding using SqDatareader in windows application

Delay in Listview Binding using SqDatareader in windows application

Scheduled Pinned Locked Moved Visual Basic
databasewpfwcfquestion
1 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    sandhya14
    wrote on last edited by
    #1

    Hi All, I have developed a windows application,have a listview in one form... Given below is the code to bind the listview :- Dim sqlCmd As SqlCommand = New SqlCommand("Select Query") Dim myData As SqlDataReader Dim lvhHelper As ListViewData = New ListViewData() Try If _con.State = ConnectionState.Open Then _con.Close() End If _con.Open() sqlCmd.Connection = _con myData = sqlCmd.ExecuteReader lvhHelper.FillListView(LstItems, myData) _con.Close() And below is the FillListView Class file Dim lvwColumn As ColumnHeader Dim itmListItem As ListViewItem Dim strTest As String Dim shtCntr As Short MyListView.Clear() For shtCntr = 0 To myData.FieldCount() - 1 lvwColumn = New ColumnHeader() lvwColumn.Text = myData.GetName(shtCntr) lvwColumn.Width = "100" MyListView.Columns.Add(lvwColumn) Next 'lvwColumn = Nothing Do While myData.Read itmListItem = New ListViewItem() strTest = IIf(myData.IsDBNull(0), "", myData.GetValue(0).ToString) itmListItem.Text = strTest For shtCntr = 1 To myData.FieldCount() - 1 If myData.IsDBNull(shtCntr) Then itmListItem.SubItems.Add("") Else itmListItem.SubItems.Add(myData.GetValue(shtCntr).ToString) End If Next shtCntr MyListView.Items.Add(itmListItem) Loop by using this codes listview is getting binded very slowly and will be blank hile loading... is there anything wrong i did in this code?.. any otherway to bind the listview using datareader?.. Thanks in Advance..

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups