Question about Generics

A

Academia

Public Class Some(Of t)

Inherits System.Windows.Forms.UserControl

....

DirectCast(ListBox1.Items(ListBox1.SelectedIndex), t).xyz = TextBox1.Text

....

TextBox1.Text = DirectCast(ListBox1.SelectedItem, t).xyz



At edit time the above statements produce an error that xyz is not a member
of t.

It works OK if instead of genetics I use, in place of t, an actual type that
has an xyz property.



How should I do this with generics?



thanks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top