Home All Groups Group Topic Archive Search About

connect bindingSource to text object.

Author
29 May 2010 11:05 AM
Mr. X.
Hello.
What is wrong of the following (the text has no data)? :

    Dim FBndDataTable As DataTable
    Dim FBndDataSource As BindingSource
....
FBndDataSource = New BindingSource
FBndDataSource.DataSource = DataTable
....
        Dim drv As DataRowView
        Dim dr As DataRow

            drv = FBndDataSource.AddNew()
            dr = drv.Row

....
' txtValue is TextBox.
  txtValue.DataBindings.Add("Text", bs, "query_id")

Thanks :)

Author
29 May 2010 11:14 AM
Mr. X.
Sorry.
I shall try again :

What is wrong of the following (the textBox has no data)? :

    Dim FBndDataTable As DataTable
    Dim FBndDataSource As BindingSource
....
FBndDataSource = New BindingSource
FBndDataSource.DataSource = DataTable
....
        Dim drv As DataRowView
        Dim dr As DataRow

            drv = FBndDataSource.AddNew()
            dr = drv.Row

            dr("query_id") = 1

            FBndDataTable.Rows.Add(dr)

FBndDataSource.Position = n ' holds the current position
....
' txtValue is TextBox.
  txtValue.DataBindings.Add("Text", bs, "query_id") 'even I put a value, I
cannot see it.

Thanks :)
Author
29 May 2010 12:27 PM
Cor Ligthert[MVP]
txtValue.DataBindings.Add("Text", FBndDataSource, "query_id") 'even I put a
value, I

You bind two properties together

Show quoteHide quote
"Mr. X." <nospam@nospam_please.com> wrote in message
news:uMHOgAy$KHA.1700@TK2MSFTNGP02.phx.gbl...
> Sorry.
> I shall try again :
>
> What is wrong of the following (the textBox has no data)? :
>
>    Dim FBndDataTable As DataTable
>    Dim FBndDataSource As BindingSource
> ...
> FBndDataSource = New BindingSource
> FBndDataSource.DataSource = DataTable
> ...
>        Dim drv As DataRowView
>        Dim dr As DataRow
>
>            drv = FBndDataSource.AddNew()
>            dr = drv.Row
>
>            dr("query_id") = 1
>
>            FBndDataTable.Rows.Add(dr)
>
> FBndDataSource.Position = n ' holds the current position
> ...
> ' txtValue is TextBox.
>  txtValue.DataBindings.Add("Text", bs, "query_id") 'even I put a value, I
> cannot see it.
>
> Thanks :)
>
Author
29 May 2010 4:10 PM
Mr. X.
Sorry,
I don't understand what should I do.

Thanks :)

Show quoteHide quote
"Cor Ligthert[MVP]" <Notmyfirstn***@planet.nl> wrote in message
news:eetUepy$KHA.5808@TK2MSFTNGP02.phx.gbl...
> txtValue.DataBindings.Add("Text", FBndDataSource, "query_id") 'even I put
> a value, I
>
> You bind two properties together
>
> "Mr. X." <nospam@nospam_please.com> wrote in message
> news:uMHOgAy$KHA.1700@TK2MSFTNGP02.phx.gbl...
>> Sorry.
>> I shall try again :
>>
>> What is wrong of the following (the textBox has no data)? :
>>
>>    Dim FBndDataTable As DataTable
>>    Dim FBndDataSource As BindingSource
>> ...
>> FBndDataSource = New BindingSource
>> FBndDataSource.DataSource = DataTable
>> ...
>>        Dim drv As DataRowView
>>        Dim dr As DataRow
>>
>>            drv = FBndDataSource.AddNew()
>>            dr = drv.Row
>>
>>            dr("query_id") = 1
>>
>>            FBndDataTable.Rows.Add(dr)
>>
>> FBndDataSource.Position = n ' holds the current position
>> ...
>> ' txtValue is TextBox.
>>  txtValue.DataBindings.Add("Text", bs, "query_id") 'even I put a value, I
>> cannot see it.
>>
>> Thanks :)
>>