Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Using the ADODC control
Message
From
19/08/2000 11:52:52
 
 
To
All
General information
Forum:
Visual Basic
Category:
Database DAO/RDO/ODBC/ADO
Title:
Using the ADODC control
Miscellaneous
Thread ID:
00407044
Message ID:
00407044
Views:
68
Hi,

I'm a VFP programmer who's learning VB, so you'll have to bear with me.

I'm using an ADODC control to navigate through a FoxPro table. The structure of the foxpro table is as follows:

idfield INTEGER
cname CHARACTER 60

I have an ADODC control in my form, and the following code in the form:
Private Sub Form_Load()
    Dim rs As New ADODB.Recordset
    rs.Open "Select * from customers", "DSN=ADOTest", adOpenKeyset, adLockPessimistic
    Set Adodc1.Recordset = rs
    Adodc1.Caption = "Customers"
End Sub
I have two textboxes in the form also, for the two fields. For field cname, I have set the MaxLength property of the texbox to 60 [the length of the field].

This works great, except for the following: if I try to edit the character field, the textbox won't let me type anything unless I go to the end of the field and delete the trailing spaces. These spaces are not added by the user - they seem to be appended either by VB or the ODBC driver.

I get around this by putting the following code in the gotfocus and lostfocus events of the textbox:

Text3.Text = Trim(Text3.Text)

If I am creating a data entry form in this way, would I have to put the above code in every textbox on the form ? In VFP for such a situation, I would put the code in my base textbox class, but I can't do that in VB.

Also, instead of using Text3 to identify the textbox, is there some way of putting in generic code in the textbox [much the same as This in VFP] ?

Best.

Matt.
Next
Reply
Map
View

Click here to load this message in the networking platform