CheckedListBox

  • Thread starter Thread starter Vann
  • Start date Start date
V

Vann

Hi, I'm having trouble loading a list into a CheckedListBox.

I have to load the list from a ListBox that's in in another form.
Here's my code.

Dim Ingrediente = New FrmABCIngredientes

Me.CheckedListBox1.Items.Add(Ingrediente.LstBoxABCIngrediente.LstBoxABCIngrediente.SelectedItem())

It compiles and runs but when I open that particular form it shows an
error in the main form in the code.

Ingrediente.Show()

I've used also SelectedItems() but it happens the same thing.

How can I do it?
 
Hi
what is the error that is shown ( what is the error message ) is it runtime
exception or an error in the code . may be you are refering to an instance
that is not set to an object when you add
ngrediente.LstBoxABCIngrediente.LstBoxABCIngrediente.SelectedItem() while
there is not item is selected . mostly this will throw an exception. if
that is not it , what is the error you get and what is its error message .
Mohamed Mahfouz
MEA Developer Support Center
ITworx on behalf of Microsoft EMEA GTSC
 
Is a runtime exception.

An unhandled exception of type
'System.Reflection.TargetInvocationException' occurred in
mscorlib.dll

Additional information: Exception has been thrown by the target of an
invocation.
 
hi
you might need to wrap this part of the code then in a try and catch block
to get the exception message
Mohamed Mahfouz
MEA Developer Support Center
ITworx on behalf of Microsoft EMEA GTSC
 
Back
Top