Results 1 to 26 of 26

Thread: Append XML file or XML Alternative

Threaded View

  1. #15
    PowerPoster
    Join Date
    Sep 2005
    Location
    Modesto, Ca.
    Posts
    5,508

    Re: Append XML file or XML Alternative

    The error message explains the problem. If you set the Datasource property, like if you bind it, then you can't use the Items.Add method to add items to the items collection.

    If you have the ComboBox bound to a field in a datatable then you would need to add the new item to the datatable and it would automatically be added to the combobox items list.

    Bind the combobox
    Code:
            Me.ComboBox1.DisplayMember = "name"
            Me.ComboBox1.ValueMember = "name"
            Me.ComboBox1.DataSource = dt
    Then to add to the items list,
    Code:
            Dim row = dt.NewRow
            row("name") = "testcb"
            dt.Rows.Add(row)
    Last edited by wes4dbt; Apr 21st, 2024 at 09:53 PM.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width