我正在尝试根据列表框中的选定项目检索对象,执行以下操作
lstAvailableAppointments.DataTextField = "AppointmentDetails"
lstAvailableAppointments.DataSource = appointments
lstAvailableAppointments.DataBind()
If lstAvailableAppointments.SelectedItem IsNot Nothing Then
Dim appointmentDetails = TryCast(lstAvailableAppointments.SelectedItem, AppointmentHelper)
End If
但我得到一个错误,说我无法将列表框项目转换为约会帮助