Re: Text Box Controls Data Bound on Tab Controls
From: Andrew McKendrick (andréwém_at_cogéco.ca)
Date: 07/01/04
- Next message: NeddyRock: "RE: Duplicate A Form Object - Please Help"
- Previous message: Wayne Wengert: "Re: 0 or 1 vs True or False"
- In reply to: Cor Ligthert: "Re: Text Box Controls Data Bound on Tab Controls"
- Next in thread: Andrew McKendrick: "Re: Text Box Controls Data Bound on Tab Controls"
- Messages sorted by: [ date ] [ thread ]
Date: Thu, 1 Jul 2004 11:11:29 -0400
Hi Cor,
I made a mistake, in my reply post (on the newsgroup). I thought that your
code worked, but it never. The only reason it worked is because I clicked
the second tab and then the first tab (by displaying the second tab the
value in that field was loaded).
But try adding the following code segment to the Form_Click event and when
you run your code DO NOT click the second tab, but click the form instead
and you'll see the message box displays either an empty string or "textbox2"
depending on what the text value of the text box was at design time and NOT
"Hello" as it should.
MessageBox.Show("I am textbox2 and the value = " & TextBox2.Text)
Let me know if you experience something different, because if you do, either
you are misunderstanding me, or something is wrong with my copy of .NET :-)
Thanks,
Andrew
"Cor Ligthert" <notfirstname@planet.nl> wrote in message
news:upMRntzXEHA.3596@tk2msftngp13.phx.gbl...
> Hi Andrew,
>
> I tried to simulate your bug, can you tell me what is different in your
> situation because with this everything goes even better than I expected?
>
> Cor
>
> \\\a form with a tabcontrol with 2 tabpages with on each a textbox
> Dim bool As Boolean
> Private Sub Form1_Load(ByVal sender As Object, _
> ByVal e As System.EventArgs) Handles MyBase.Load
> Dim dt As New DataTable
> dt.Columns.Add("my")
> Dim dr As DataRow = dt.NewRow
> dr(0) = "Hello"
> dt.Rows.Add(dr)
> Me.TextBox1.DataBindings.Add("text", dt, "my")
> Me.TextBox2.DataBindings.Add("text", dt, "my")
> bool = True
> End Sub
> Private Sub TabControl1_SelectedIndexChanged(ByVal _
> sender As Object, ByVal e As System.EventArgs) Handles _
> TabControl1.SelectedIndexChanged
> If bool Then
> Select Case TabControl1.SelectedIndex
> Case 0
> MessageBox.Show("I am textbox2 and the value = " &
> TextBox2.Text)
> Case 1
> MessageBox.Show("I am textbox1 and the value = " &
> TextBox1.Text)
> End Select
> End If
> End Sub
> ///
>
> ,
> >
> > I've noticed a bug in VB.NET (latest .NET Framework)...
> >
> > - I have a TabControl on a form with several tabs.
> > - Each tab contains text boxes that are bound to fields in a data source
> > (DataBindings).
> > - When I display a record and then try to access the .Text property of
one
> > of the text boxes on any tab except the current tab, the result is an
> Empty
> > string.
> >
> > This occurs even though the fields that the text boxes are bound to have
> > data in them. If I display the tab and then try to read the contents of
> the
> > Text Boxes, then the data is there.
> >
> > Anyone know if there is a work around to this? Some way to force the
text
> > boxes to grab the data before they are displayed?
> >
> > Thanks in advance,
> >
> > Andrew
> >
> >
> >
>
>
- Next message: NeddyRock: "RE: Duplicate A Form Object - Please Help"
- Previous message: Wayne Wengert: "Re: 0 or 1 vs True or False"
- In reply to: Cor Ligthert: "Re: Text Box Controls Data Bound on Tab Controls"
- Next in thread: Andrew McKendrick: "Re: Text Box Controls Data Bound on Tab Controls"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|