468,512 Members | 1,396 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,512 developers. It's quick & easy.

DataBindings At "RunTime" Problems

I've tried to create 11 textboxes as variables (not actually visible in
the program, not in Windows Form Designer) and have set DataBindings to
the text properties of the TextBoxes BUT according to tests I've run, it
says that the DataBindings exist, but the IsBinding is set to False, and
is ReadOnly (the bindings exist, they just aren't active AND I
can't/don't know how to make them active). Is there any way to allow
these 11 textboxes' text properties to have a DataBinding attached to it
at RunTime? Thanks for any help!
Nov 20 '05 #1
9 2406
Hi,

This is how to bind a textbox thru code.
TextBox1.DataBindings.Add("Text", ds.Tables(0), "myColumnName")

Ken

---------------------------

"HAN(removethis)twister" <"HAN(removethis)twister"@comcast.net> wrote in
message news:e4**************@TK2MSFTNGP11.phx.gbl...
I've tried to create 11 textboxes as variables (not actually visible in
the program, not in Windows Form Designer) and have set DataBindings to
the text properties of the TextBoxes BUT according to tests I've run, it
says that the DataBindings exist, but the IsBinding is set to False, and
is ReadOnly (the bindings exist, they just aren't active AND I can't/don't
know how to make them active). Is there any way to allow these 11
textboxes' text properties to have a DataBinding attached to it at
RunTime? Thanks for any help!

Nov 20 '05 #2
Cor
Hi Han,

To what do you want the textboxes to bind?

Cor

I've tried to create 11 textboxes as variables (not actually visible in
the program, not in Windows Form Designer) and have set DataBindings to
the text properties of the TextBoxes BUT according to tests I've run, it
says that the DataBindings exist, but the IsBinding is set to False, and
is ReadOnly (the bindings exist, they just aren't active AND I
can't/don't know how to make them active). Is there any way to allow
these 11 textboxes' text properties to have a DataBinding attached to it
at RunTime? Thanks for any help!

Nov 20 '05 #3
Cor wrote:
Hi Han,

To what do you want the textboxes to bind?

Cor
I've tried to create 11 textboxes as variables (not actually visible in
the program, not in Windows Form Designer) and have set DataBindings to
the text properties of the TextBoxes BUT according to tests I've run, it
says that the DataBindings exist, but the IsBinding is set to False, and
is ReadOnly (the bindings exist, they just aren't active AND I
can't/don't know how to make them active). Is there any way to allow
these 11 textboxes' text properties to have a DataBinding attached to it
at RunTime? Thanks for any help!


Different Columns in two different tables.
Nov 20 '05 #4
HAN(removethis)twister wrote:
Cor wrote:
Hi Han,

To what do you want the textboxes to bind?

Cor
I've tried to create 11 textboxes as variables (not actually visible in
the program, not in Windows Form Designer) and have set DataBindings to
the text properties of the TextBoxes BUT according to tests I've run, it
says that the DataBindings exist, but the IsBinding is set to False, and
is ReadOnly (the bindings exist, they just aren't active AND I
can't/don't know how to make them active). Is there any way to allow
these 11 textboxes' text properties to have a DataBinding attached to it
at RunTime? Thanks for any help!


Different Columns in two different tables.

I created a textbox in the Form Designer with a DataBinder as reference,
copied the code to make the DataBinding to the Text Property, and edited
it for each textbox, and put this "code" in the Load event of the form.
My problem, as stated before, is that the IsBinding Property for some
reason is set to false, and I need it to be set to true.
Nov 20 '05 #5
Cor
Hi Han,

This is the only code you need to bind a textbox.

\\\code changed watch typos as sample
textbox1.DataBindings.Add(New Binding("Text", dataset1.Tables(0),
"FirstName"))
textbox2.DataBindings.Add(New Binding("Text", dataset1.Tables(0),
"LastName"))
///
If you want to scroll up through it
\\\
CType(BindingContext(dataset1.Tables(0)), CurrencyManager).position += 1
///
,

I hope this helps,

Cor
Nov 20 '05 #6
Cor wrote:
Hi Han,

This is the only code you need to bind a textbox.

\\\code changed watch typos as sample
textbox1.DataBindings.Add(New Binding("Text", dataset1.Tables(0),
"FirstName"))
textbox2.DataBindings.Add(New Binding("Text", dataset1.Tables(0),
"LastName"))
///
If you want to scroll up through it
\\\
CType(BindingContext(dataset1.Tables(0)), CurrencyManager).position += 1
///
,

I hope this helps,

Cor

I've tried this, the IsBinding property is still set to false!
Nov 20 '05 #7
Cor wrote:
Hi Han,

Send some code, I am looking in the dark.

And please paste it first in a notebook, copy it then and paste it than in
this message because others it is mostly unreadable.

Cor

Right Underneath "Windows Form Designer Code" Region:
Dim InvTxt(10) As TextBox

After Clear, Fill Commands in Form_Load Sub:
Dim num As Integer
For num = 0 To 10
InvTxt(num) = New TextBox
Next
InvTxt(0).DataBindings.Add("Text", C_DataSet1.Tables("Customers"),
"CustomerAccountMoney")
InvTxt(1).DataBindings.Add("Text", C_DataSet1.Tables("Customers"),
"CustomerNameLast")
InvTxt(2).DataBindings.Add("Text", C_DataSet1.Tables("Customers"),
"CustomerNameFirst")
InvTxt(3).DataBindings.Add("Text", C_DataSet1.Tables("Customers"),
"CustomerAddressLn1")
InvTxt(4).DataBindings.Add("Text", C_DataSet1.Tables("Customers"),
"CustomerAddressLn2")
InvTxt(5).DataBindings.Add("Text", C_DataSet1.Tables("Customers"),
"CustomerAddressLn3")
InvTxt(6).DataBindings.Add("Text", C_DataSet1.Tables("Customers"),
"CustomerAddressLn4")
InvTxt(7).DataBindings.Add("Text", C_DataSet1.Tables("Customers"),
"CustomerAddressLn5")
InvTxt(8).DataBindings.Add("Text", C_DataSet1.Tables("Customers"),
"CustomerUsesSalesTax")
InvTxt(9).DataBindings.Add("Text", C_DataSet1.Tables("Invoices"),
"InvoiceID")
InvTxt(10).DataBindings.Add("Text", C_DataSet1.Tables("Customers"),
"CustomerServAfterMonths")
Dim result As String
Dim result2 As String
For num = 0 To 10
result += InvTxt(num).Text & " "
result2 += Iif(InvTxt(num).DataBindings.Item("Text").IsBindin g, "Yes",
"No") & " "
Next
MsgBox(result) 'result = " "
MsgBox(result2) 'result2 = "No No No No No No No No No No No "
(result's purpose: determine if any text is in textboxes. Result: FALSE)
(result2's purpose: determine if binded. Result: FALSE)
Nov 20 '05 #8
Cor
Hi Han,

May I see your select statements and your fill also, when there are by
instance case differences, it won't work.

This seems to me OK.

Cor
Hi Han,

Send some code, I am looking in the dark.

And please paste it first in a notebook, copy it then and paste it than in this message because others it is mostly unreadable.

Cor

Right Underneath "Windows Form Designer Code" Region:
Dim InvTxt(10) As TextBox

After Clear, Fill Commands in Form_Load Sub:
Dim num As Integer
For num = 0 To 10
InvTxt(num) = New TextBox
Next
InvTxt(0).DataBindings.Add("Text", C_DataSet1.Tables("Customers"),
"CustomerAccountMoney")
InvTxt(1).DataBindings.Add("Text", C_DataSet1.Tables("Customers"),
"CustomerNameLast")
InvTxt(2).DataBindings.Add("Text", C_DataSet1.Tables("Customers"),
"CustomerNameFirst")
InvTxt(3).DataBindings.Add("Text", C_DataSet1.Tables("Customers"),
"CustomerAddressLn1")
InvTxt(4).DataBindings.Add("Text", C_DataSet1.Tables("Customers"),
"CustomerAddressLn2")
InvTxt(5).DataBindings.Add("Text", C_DataSet1.Tables("Customers"),
"CustomerAddressLn3")
InvTxt(6).DataBindings.Add("Text", C_DataSet1.Tables("Customers"),
"CustomerAddressLn4")
InvTxt(7).DataBindings.Add("Text", C_DataSet1.Tables("Customers"),
"CustomerAddressLn5")
InvTxt(8).DataBindings.Add("Text", C_DataSet1.Tables("Customers"),
"CustomerUsesSalesTax")
InvTxt(9).DataBindings.Add("Text", C_DataSet1.Tables("Invoices"),
"InvoiceID")
InvTxt(10).DataBindings.Add("Text", C_DataSet1.Tables("Customers"),
"CustomerServAfterMonths")
Dim result As String
Dim result2 As String
For num = 0 To 10
result += InvTxt(num).Text & " "
result2 += Iif(InvTxt(num).DataBindings.Item("Text").IsBindin g, "Yes",
"No") & " "
Next
MsgBox(result) 'result = " "
MsgBox(result2) 'result2 = "No No No No No No No No No No No "
(result's purpose: determine if any text is in textboxes. Result: FALSE)
(result2's purpose: determine if binded. Result: FALSE)

Nov 20 '05 #9
Cor wrote:
Hi Han,

May I see your select statements and your fill also, when there are by
instance case differences, it won't work.

This seems to me OK.

Cor

Hi Han,

Send some code, I am looking in the dark.

And please paste it first in a notebook, copy it then and paste it than
in
this message because others it is mostly unreadable.

Cor


Right Underneath "Windows Form Designer Code" Region:
Dim InvTxt(10) As TextBox

After Clear, Fill Commands in Form_Load Sub:
Dim num As Integer
For num = 0 To 10
InvTxt(num) = New TextBox
Next
InvTxt(0).DataBindings.Add("Text", C_DataSet1.Tables("Customers"),
"CustomerAccountMoney")
InvTxt(1).DataBindings.Add("Text", C_DataSet1.Tables("Customers"),
"CustomerNameLast")
InvTxt(2).DataBindings.Add("Text", C_DataSet1.Tables("Customers"),
"CustomerNameFirst")
InvTxt(3).DataBindings.Add("Text", C_DataSet1.Tables("Customers"),
"CustomerAddressLn1")
InvTxt(4).DataBindings.Add("Text", C_DataSet1.Tables("Customers"),
"CustomerAddressLn2")
InvTxt(5).DataBindings.Add("Text", C_DataSet1.Tables("Customers"),
"CustomerAddressLn3")
InvTxt(6).DataBindings.Add("Text", C_DataSet1.Tables("Customers"),
"CustomerAddressLn4")
InvTxt(7).DataBindings.Add("Text", C_DataSet1.Tables("Customers"),
"CustomerAddressLn5")
InvTxt(8).DataBindings.Add("Text", C_DataSet1.Tables("Customers"),
"CustomerUsesSalesTax")
InvTxt(9).DataBindings.Add("Text", C_DataSet1.Tables("Invoices"),
"InvoiceID")
InvTxt(10).DataBindings.Add("Text", C_DataSet1.Tables("Customers"),
"CustomerServAfterMonths")
Dim result As String
Dim result2 As String
For num = 0 To 10
result += InvTxt(num).Text & " "
result2 += Iif(InvTxt(num).DataBindings.Item("Text").IsBindin g, "Yes",
"No") & " "
Next
MsgBox(result) 'result = " "
MsgBox(result2) 'result2 = "No No No No No No No No No No No "
(result's purpose: determine if any text is in textboxes. Result: FALSE)
(result2's purpose: determine if binded. Result: FALSE)


Thanks for your time, a friend fixed my problem. (my Cable Internet was
down for the past couple of days, sorry It took so long to respond.)
Nov 20 '05 #10

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by gagaguy | last post: by
reply views Thread by Master Programmer | last post: by
reply views Thread by NPC403 | last post: by
1 post views Thread by fmendoza | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.