OK, this is what I do
Ive a class that I use to create an object and insert that object to a combobox
I call this class to create the object like this
now, when I try to retrieve the value of the object I use this
this is supposed to work, but I get this error when I compile
c:\projects\csyst\csyst\FrmCompanies.cs(237,36): error CS0118: System.Windows.Forms.ComboBox.Items denotes a property where a method was expected
what am I missing, what am I doing wrong??? what I need to make this work???
Thanks for your help
Ive a class that I use to create an object and insert that object to a combobox
C#:
using System;
namespace CSyst
{
public class c_Company
{
public string s_Name;
public string s_ID;
public c_Company(string ID, string Name)
{
s_Name = Name;
s_ID = ID;
}
public override string ToString()
{
return s_ID.Trim() + " - " + s_Name.Trim();
}
}
}
I call this class to create the object like this
C#:
cmbCompany.Items.Add(new c_Company("VALUE1","VALUE2"));
now, when I try to retrieve the value of the object I use this
C#:
c_Company s_com = cmbCompany.Items(cmbCompany.SelectedIndex); // I GET THE ERROR HERE
string xx = s_com.s_ID;
this is supposed to work, but I get this error when I compile
c:\projects\csyst\csyst\FrmCompanies.cs(237,36): error CS0118: System.Windows.Forms.ComboBox.Items denotes a property where a method was expected
what am I missing, what am I doing wrong??? what I need to make this work???
Thanks for your help