Textbox Data Binding Problem
Hi Everyone, i need a hand on how do i set my initial value for textbox as blank. I tried to I load my textbox a data coming from my database but what my problem is that I need to set my default value for textbox as blank because everytime I load the forms the textbox will be filled immediately with data. This is how I bind my textbox and combobox after loading from database.
Code:
cbxJoblvl.DataSource = myDataSet.DefaultViewManager;
cbxJoblvl.DisplayMember = "Joblevel.lvl";
cbxJoblvl.SelectedIndex = -1;
txtLvlName.DataBindings.Add("Text", myDataSet.DefaultViewManager, "Joblevel.lvlname");
Re: Textbox Data Binding Problem
First of all, it's pointless binding to the DefaultViewManager of a DataSet, just as it's pointless to bind to the DefaultView of a DataTable. When binding to a DataSet or DataTable, it's the DefaultView of each DataTable that the data comes from anyway.
As for the question, I just tested and even setting the SelectedIndex after binding the TextBox didn't help. I think that you're just going to have to explicitly clear the TextBox if you want no record selected.