Error bc30574 Option strict on disable late binding

Shay Wilner 1,726 Reputation points
2020-04-22T14:05:26.587+00:00

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

Universal Windows Platform (UWP)
0 comments No comments
{count} votes

Accepted answer
  1. Peter Fleischer (former MVP) 19,231 Reputation points
    2020-04-22T14:37:15.3+00:00

    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 person found this answer helpful.

0 additional answers

Sort by: Most helpful