Community
I have practiced this exercise:
http://www.inmotioncon.com/Downloads/Nothing%20but%20.Net-Handout.pdf
It´s great this document!
In the windows form, there are:
Friend aligns As List(Of Objects.BaseObject) ......... Me.dgvAlign.DataSource = aligns Me.cboStyle.DataSource = aStyles Me.cboStyle.DisplayMember = "Name" Me.cboStyle.ValueMember = "Id"
But I´m traying the following:
I have some labels and I want show different alignments properties depending The alignment selected in the combobox.
private void cboStyle_SelectedIndexChanged(object sender, EventArgs e) { string s = ((aligns)cboStyle.SelectedItem).Name; label1.text=s }
But Visual Studio say me: "aligns" is "filed" but it uses as a "type".
What can I do? I must use ArrayList? I must create a new class for align?
You are trying to do force conversion here, to convert cboStyle.SelectedItem to Alignment type, it should be a type name:
string s = ((Alignment)cboStyle.SelectedItem).Name;