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

Posted on 2004-11-08
Last Modified: 2011-10-03
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?
Question by:tigrisek
    LVL 16

    Accepted 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


    LVL 19

    Expert Comment

    by:Stephen Manderson
    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

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    What Should I Do With This Threat Intelligence?

    Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

    The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
    When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
    Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
    This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

    759 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    8 Experts available now in Live!

    Get 1:1 Help Now