[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 214
  • Last Modified:

There's a problem with binding to an invisible textbox control

When binding the data from database to textbox control, which is visible - everything is ok, but if I change visible=false, the control doesn't receive the binding value, but there's always textbox1 :(
Similar problem appears when the control is on other tabpage than shown at the moment. Only when I go to the given tabpage, the control receives binding value.
How to solve it?
1 Solution
It may suffer the same problems as trying to set the focus to an invisible text box -- you might have to make the textbox visible before it can be a legitimate destination.  I guess possible workarounds could be:

   -   Making the textbox really small, instead of invisible.
   -   Matching the BackColor and ForeColor properties to that of the Form
   -   Placing your data reader textbox on another, minimised form and copying across


Stephen MandersonCommented:
Hi there, I have had similar problems. What i done to solve them is make a connection to the db manualy, and get that to fill the data of the text boxes. You could try this in the main page of the form load.

Private Sub Form_Load()
Dim conn As New ADODB.Connection
Dim rs As New ADODB.Recordset

conn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=DatabaseLocation.mdb;"

sqlstr = "Table"

rs.Open sqlstr, conn, adOpenKeyset, adLockOptimistic

with rs
             .Fields("Text1")    =   Text1.text
             .Fields("Text2")    =   Text2.text

End With

Set rs = Nothing
Set conn = Nothing
End Sub

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now