Hi,

I want to add a new contact to the table in a database (using ADO Control) but when I write a contact name in a text box it should be automatically changed to upper case even i write in a lower case.

Regards,

user777

Hi,

I want to add a new contact to the table in a database (using ADO Control) but when I write a contact name in a text box it should be automatically changed to upper case even i write in a lower case.

Regards,

user777

TextBoxes does have an even called "Change", right? well, make .Text=UCase(.Text) there. That's all.

Just be sure your TextBox is "linked" to your ADO Control, and the DataSource and DataField properties are set.

there are alot of way to do that, I give you 2 ways to do that

First Way : using Change Event

Private Sub Text1_Change()
    Dim LastStart As Integer
    LastStart = Text1.SelStart
    Text1.Text = UCase(Text1.Text)
    Text1.SelStart = LastStart
End Sub

Second Way : using KeyPress event

Private Sub Text1_KeyPress(KeyAscii As Integer)
    KeyAscii = Asc(UCase(Chr(KeyAscii)))
End Sub
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.