In a window application- Why the Combobox1.SelectedValue is returning null?

csharp.net , asp.net , java India
  • 12 years ago
    PROBLEM OCCURING INSIDE A WINDOW APPLICATION-- //Code used to fill the combobox cmbddlAgency objAgency.LoadAgencyName(); cmbddlAgency.DisplayMember = "AgencyID"; cmbddlAgency.ValueMember = "AgencyID"; foreach (DataRow dr in objAgency.AgencymasterDS.Tables["Table"].Rows) { cmbddlAgency.Items.Add(dr["AgencyName"]); } cmbddlAgency.SelectedText = "--Select--"; // I have not used dataset as datasource directly because this instruction - // cmbddlAgency.DataSource = objAgency.AgencymasterDS.Tables[0]; // firing the event combobox selected index changed and the control goes to event handler with filling only one record. // selectedvalue is coming null // this line is inside the combobox selectedindexchanged event handler. objCusRefNo.LoadCusRefNo(Convert.ToInt64(cmbddlAgency.SelectedValue));

Post a reply

No one has replied yet! Why not be the first?

Sign in or Join us (it's free).

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“Most software today is very much like an Egyptian pyramid with millions of bricks piled on top of each other, with no structural integrity, but just done by brute force and thousands of slaves” - Alan Kay