Hello, for days I have this problem, don't manage to solve it.
I have 2 winforms (form1 and form2).
On form1 i have a databinded combobox and a databinded textbox. Both are binded to the same bindingsource.
On form2 i have two textboxes. I wan't the two textboxes to show the text from the combobox and textbox from form1.
I have the folowing code on form1:
VB.NET:
Public Class Form1
Private Sub BedrijvenBindingNavigatorSaveItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BedrijvenBindingNavigatorSaveItem.Click
Me.Validate()
Me.BedrijvenBindingSource.EndEdit()
Me.BedrijvenTableAdapter.Update(Me.Docregdata2DataSet.Bedrijven)
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'TODO: This line of code loads data into the 'Docregdata2DataSet.Bedrijven' table. You can move, or remove it, as needed.
Me.BedrijvenTableAdapter.Fill(Me.Docregdata2DataSet.Bedrijven)
End Sub
Private Sub BedrijfsnaamComboBox_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles BedrijfsnaamComboBox.SelectedIndexChanged
My.Forms.Form2.TextBox1.Text = Me.BedrijfsnaamComboBox.Text
My.Forms.Form2.TextBox2.Text = Me.PlaatsTextBox.Text
End Sub
End Class
On form2 i have this code:
VB.NET:
Public Class Form2
Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
My.Forms.Form1.BedrijvenTableAdapter.Fill(My.Forms.Form1.Docregdata2DataSet.Bedrijven)
My.Forms.Form1.BedrijvenBindingSource.Position = 2
Me.TextBox1.Text = My.Forms.Form1.BedrijfsnaamComboBox.Text
Me.TextBox2.Text = My.Forms.Form1.PlaatsTextBox.Text
End Sub
End Class
But what happens is this:
The textbox on form2 shows correctly the text from the combobox on form1, even when i change the selection with the combo on form1.
But the second textbox on form2 shows on formload nothing? Why not???
When i change the selection with the combobox on form1 the textbox on form2 shows constantly the value from the selection before! So the textbox stays behind the combobox. wHY??
Are tried several things: endedit, update, refresh. Nothing help?!!
Any help?!