combobox and datagridview

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
Please help,
Im trying to select a company name from a data bound combo box, then display
the relevant record in a data bound datagridview but i have some problem. Everything is working well on start, when I selected value from combobox then related value is shown, but when I click to close program I have next error:
"Cannot perform = operation on System.Int16 and System.String."
ther is code for combobox
privatevoidcbPoreznaGrupa_SelectedIndexChanged(objectsender,EventArgse)
{

this.knjigaRacunaStavkeBindingSource.Filter = "Sifra = "+" "+ cbPoreznaGrupa.SelectedValue + " ";
}
likewise i try with another code, like this:
this.knjigaRacunaStavkeBindingSource.Filter =String.Format("Sifra={0}", cbPoreznaGrupa.SelectedItem.ToString());
but same error.
I try with this code:
this.knjigaRacunaStavkeBindingSource.Filter ="Sifra = "+""+ cbPoreznaGrupa.SelectedValue.ToString() + "";
but get this error:
"Object reference not set to an instance of an object."
help, please


View the full article
 


Write your reply...
Back
Top