locked
Bind value to listview how do this RRS feed

  • Question

  • private sub LstAdd()

    Dim Con As OleDbConnection = New OleDbConnection("Provider=Microsoft.jet.oledb.4.0;data source=d:\block.mdb")

    Dim Cmd As OleDbCommand = New OleDbCommand("SELECT * FROM blocks order by block_name", Con)

    Con.Open()

    Dim mTxt As String

    mTxt = ""

    Dim data_reader As Data.IDataReader = Cmd.ExecuteReader()

    Do While data_reader.Read()

       If data_reader.Item("block_name").ToString <> "" Then

            Dim new_item As New ListViewItem(data_reader.Item("block_name").ToString)

                new_item.SubItems.Add(data_reader.Item("block_id").ToString)

                LstBlock.Items.Add(new_item)

                mTxt = data_reader.Item("block_name").ToString

       End If

    <place w:st="on">Loop</place>

    <place w:st="on">end sub</place>

    How to bind in database with listview control, this code to add value without bind to add value. Plz tell me


    JapniesMapel

    Tuesday, February 26, 2013 1:08 PM

All replies

  • the ListView control doesn't support databinding.

    you need to add items manually as you're already doing


    thanks for any help

    Tuesday, February 26, 2013 2:59 PM
  • Most people who use the Listview use currently the binding inside the HTML code. 

    Visit for that the Microsoft ASP.Net forum.

    http://forums.Asp.Net

    If it is for XAML then use the WPF forum.

    http://forums.Asp.Net

    Your question give me not the idea that it is for Windows Forms, but in that case use a DataGridView and bind the data to the DataSource.

    This is the forum for that one.

    http://social.msdn.microsoft.com/Forums/en-US/winforms/threads



    Success
    Cor


    Tuesday, February 26, 2013 3:26 PM
  •  This procedure in vb2005 one form, this procedure propear way to execute, but under do.....Loop. How to bind value without do..........Loop


    JapniesMapel

    Wednesday, February 27, 2013 6:25 AM