bman9111
asked on
vb.net databinding
I have this program I created using databindings.
I hate binding but for this application it is pretty small. ANyways I have 10 textboxes on form2
form1 comes up and asks user to pick a name. The user picks a name and then it calls form2 and grabs the data from the database and dumps into a dataset. This dataset is typed dataset... I then call my databinding like this
textbox1.DataBindings.Add( "text", dataset1.tablename, "fieldname")
everything works fine, but then when I close form2 and then let the user select another name from form1. Form2 shows up blank. There is nothing being pulled in. Now I changed my dataset and data is being dumped into it successfully. Why is it showing the 1st time but not the second. Is there some type of databinding release I need to do????
Please help....
I hate binding but for this application it is pretty small. ANyways I have 10 textboxes on form2
form1 comes up and asks user to pick a name. The user picks a name and then it calls form2 and grabs the data from the database and dumps into a dataset. This dataset is typed dataset... I then call my databinding like this
textbox1.DataBindings.Add(
everything works fine, but then when I close form2 and then let the user select another name from form1. Form2 shows up blank. There is nothing being pulled in. Now I changed my dataset and data is being dumped into it successfully. Why is it showing the 1st time but not the second. Is there some type of databinding release I need to do????
Please help....
ASKER
got it, but Have no idea why it works
if my form2_load I have the following code
databaseconnection() 'this call the database
Application.DoEvents()
dataset1.table1.Rows.Clear ()
commands= connections
commands.CommandText = "select * from table1 where userinput= '" & combobox1.text & "'"
dataadapter.SelectCommand = commands
dataadapter.Fill(dataset1, "Table1")
call populatetextboxes ' this is for the databindings
I had to take the dataset1.table1.Rows.Clear () out and put it into the form2_closing
why, what is the difference if I call it before or after. I even wrote the dataset1.table1.writexml to look to see if the data was going in and it was. So why does this fix my problem????
Any ideas...
if my form2_load I have the following code
databaseconnection() 'this call the database
Application.DoEvents()
dataset1.table1.Rows.Clear
commands= connections
commands.CommandText = "select * from table1 where userinput= '" & combobox1.text & "'"
dataadapter.SelectCommand = commands
dataadapter.Fill(dataset1,
call populatetextboxes ' this is for the databindings
I had to take the dataset1.table1.Rows.Clear
why, what is the difference if I call it before or after. I even wrote the dataset1.table1.writexml to look to see if the data was going in and it was. So why does this fix my problem????
Any ideas...
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
If not you could use:
Dataset.Clear
Dataset.Dispose