Prevent Listbox selection from changing

Jan 30 2019 5:56 AM
Hi,
I am very new to C# and coding in general. I have a question regarding my little project. I have Multiple Listboxes that are connected to my SQL Database. Under the Listboxes I have Textboxes to enter new values into the Database. The problem I'm having is that whenever I enter something in a textbox (I made it so hitting enter would run the Keydown event to add the line) the selection from my Listboxes changes. That is annoying since what I have selected is important since I joined multiple Databases and the selection is what determines where the input goes.
So my question is, is there a way in WPF or C# to prevent the selected item from beeing unselected?
I have googled around for a while, but can't find anything except explenations that I just don't understand with the little knowledge I have.
 
Hope someone can help me out. Thank you! 

Answers (1)