Import Row... HELP!!!

M

Mike Gorgone

Hi All,

Quite the Quandry here... I've got two list boxes with datasets bound
to them. Items from the listboxes can be moved from one listbox to
another and vice versa. The problem is that when a listbox is empty
the first time I load it the load takes about 2 seconds and after that
it's nice and quick (even if I close and reopen the form). So the
lists look like this...

List1 List2
------- -------
Item1 Item2
Item3 [Add >>]
[<< Remove]

If the lists are in this configuration when I load up and then I
remove Item2 (moving it to List1) and then add any item from List1
back to List2 I get the delay. After that everything is fine. The
removal from List2 and addition to List1 is quick. I'm guessing
because there are items on the list already.

When the form loads I bind the datasets to the listboxes with the
DataSource property. The code I use to move an Item from List2 to
List1 is as follows and the slow down occurrs on the ImportRow line.

Dim SelectedRow As DataRow
SelectedRow = CType(AssignedSecurityRoles.SelectedItem,
DataRowView).Row
_List1DS.Tables(0).ImportRow(SelectedRow)
_List2DS.Tables(0).Rows.Remove(SelectedRow)

That's all the code I need to move the rows (reversed in the case of
an Item going from List1 to List2.


ANY help or insight on this would be greatly appreciated as I have now
spent 8 hours on the damn problem.

Thanks in advance,
Mike Gorgone
(e-mail address removed)
 
C

Cor Ligthert

Hi Mike,

I do not know this problem and I do not know what is slow, however does the
control you are using a Beginupdate and an Endupdate, maybe you can try
that?

Cor
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top