-1

Probably a really newbie question but I have developed some code for transferring items from a list box that is split into two parts and now want it to be transported into a list view in a separate form.

The code I have is this: enter image description here

Any help you can give me is very helpful, thank you very much.

David
  • 208,112
  • 36
  • 198
  • 279
  • The error in your image doesn't match the description in your question. Can you clarify what you're asking? – David Dec 02 '15 at 13:48
  • It does, I have stated what I am trying to do but I needs someone to tell Me what is causing the error? – Sam Sheppard Dec 02 '15 at 13:57
  • The error has nothing to do with "separate forms". You're just trying to cast between two unrelated types. The same error would happen on "one form" if you tried to do the same thing. The error you're receiving and the question you're asking have nothing to do with one another. So it's not clear *which* you want answered. – David Dec 02 '15 at 14:03
  • Okay David, But I am still stuck, I dont know how to handle matches and now I am receiving a different error. – Sam Sheppard Dec 02 '15 at 14:37
  • Maybe you can explain what a `Match` *is*? And what the error *is*? Try to understand that I can't see your screen from here. – David Dec 02 '15 at 14:38
  • I have uploaded multiple pictures which should explain what I am trying to do and what errors I am getting. https://i.gyazo.com/7a47c844fe6bf6ff162e44cdc3472a90.png – Sam Sheppard Dec 02 '15 at 14:41

1 Answers1

1

The exception is telling you the problem:

Conversion from type Match to type String is not valid.

Look at what you're trying to do:

For Each item As String In ListBox1.Items

Clearly, ListBox1.Items contains a collection of Match objects, not a collection of String objects. So you need to loop over those objects:

For Each item As Match In ListBox1.Items

Of course, we don't know what a Match object is, since you haven't shown that. Presumably it contains a string somewhere, which you should be able to get from item in your logic. But the point is that you can't implicitly convert one type to another, you have to use the correct type in your loop.

David
  • 208,112
  • 36
  • 198
  • 279