I have this code inside of my button's event. The problem I am having is that the text input into the database is always the text from the first index of the listbox named categoryLst. I even used a listbox selection change event to change the text whenever the listbox was changed. But that became a lot more code and it still didn't work. I still get whatever is first in the list. I don't understand why this is happening. I am thinking it's a timing issue of some kind.
I need some help figuring out how I can get the text from the selection made, not the first one in the list. It's stuck and not changing for me when processing code. The user can change the selection in the list box and then hit the submit button. What is going on?Code:comm.Parameters.Add("@Relation", System.Data.SqlDbType.NVarChar, 20); comm.Parameters["@Relation"].Value = categoryLst.SelectedItem.Text;




Reply With Quote