question

65010773 avatar image
0 Votes"
65010773 asked ·

Error bc30574 Option strict on disable late binding

Hi

I get this error when i try to assign the content of a combobox item to a string

comboyear is a combobox

 dim  title as string
 title = comboyear.items(comboyear.SelectedIndex).content 

Thanks

windows-uwp
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

PeterFleischer-3316 avatar image
1 Vote"
PeterFleischer-3316 answered ·

Hi, comboyear.items(comboyear.SelectedIndex) gets you an object. Object hasn't property content. You should cast comboyear.items(comboyear.SelectedIndex) to typ of item. If you bind ItemsSource to List(Of Data) you must cast to Data like this:

  dim  title as string
  title = ctype(comboyear.items(comboyear.SelectedIndex), Data).content 

In this case your class Data must have property "content".

· 1 · Share
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Thanks

 title = CType(Comboyears.Items(Comboyears.SelectedIndex), ComboBoxItem).Content.ToString





0 Votes 0 · ·