TEXTBOX
                    Olá amigos aqui do fórum estou precisando da ajuda de vcs 
Amigs estou montando um programa aqui para empresa certo de cadastro, controle estoque e por ai vai
O meu problema é
Tenho varios texbox tipo quando ele receber o foco queria que ele mudasse a cor vcs poderiam me ensimar por favor essa rotima tenho um form do 17 textbox no caso e o cadastro de cliente resumindo todos veze que ele recebe o lostfocus mudasse a cor
            Amigs estou montando um programa aqui para empresa certo de cadastro, controle estoque e por ai vai
O meu problema é
Tenho varios texbox tipo quando ele receber o foco queria que ele mudasse a cor vcs poderiam me ensimar por favor essa rotima tenho um form do 17 textbox no caso e o cadastro de cliente resumindo todos veze que ele recebe o lostfocus mudasse a cor
                    No Evento [Ô]Got_Focus[Ô] você muda a cor do textbox.
                
            
                    Vejo duas possibilidades:
1. Evento [Ô]Got_Focus[Ô], conforme mencionado pelo colega ASHKATCHUP.
2. Utilizar um controle TIMER com a propriedade INTERVAL com um valor pequeno e uma rotina para validar e colorir o CONTROLE ATIVO.
            1. Evento [Ô]Got_Focus[Ô], conforme mencionado pelo colega ASHKATCHUP.
2. Utilizar um controle TIMER com a propriedade INTERVAL com um valor pequeno e uma rotina para validar e colorir o CONTROLE ATIVO.
                    Coloque um timer em seu projeto mude a propriedade interval = 1
e cole este código
veja se funciona
                
            e cole este código
Private Sub Timer1_Timer()
Dim txtName As String
Dim txt As TextBox
Dim ctl  As control
If TypeOf Me.ActiveControl Is TextBox Then txtName = Me.ActiveControl.Name
For Each ctl In Me
    If txtName = ctl.Name Then
        ctl.BackColor = vbYellow
        ctl.ForeColor = vbBlue
    Else
        If TypeOf ctl Is TextBox Then
            ctl.BackColor = vbWhite
            ctl.ForeColor = vbBlack
        End If
    End If
Next
End Subveja se funciona
                    Cara,
Eu testei com o código do Marcelo-Treze e deu um erro aqui.
então eu peguei o raciocÃnio dele e fiz assim:
Coloquei um Timer, Configurei seu Interval para 1
AÃ, dentro da Sub Timer1_Timer, eu segui o raciocÃnio do Marcelo-Treze e fiz:
[txt-color=#0000f0]Private Sub[/txt-color] Timer1_Timer()
[txt-color=#0000f0] If [/txt-color]Me.ActiveControl [txt-color=#0000f0]Is[/txt-color] Text1 [txt-color=#0000f0]Then[/txt-color] Text1.BackColor = vb3DShadow [txt-color=#0000f0]Else[/txt-color] Text1.BackColor = vbWhite
[txt-color=#0000f0] If[/txt-color] Me.ActiveControl [txt-color=#0000f0]Is [/txt-color]Text2 [txt-color=#0000f0]Then[/txt-color] Text2.BackColor = vb3DShadow [txt-color=#0000f0]Else[/txt-color] Text2.BackColor = vbWhite
[txt-color=#0000f0] If[/txt-color] Me.ActiveControl [txt-color=#0000f0]Is [/txt-color]Text3 [txt-color=#0000f0]Then[/txt-color] Text3.BackColor = vb3DShadow [txt-color=#0000f0]Else[/txt-color] Text3.BackColor = vbWhite
[txt-color=#0000f0] If[/txt-color] Me.ActiveControl [txt-color=#0000f0]Is [/txt-color]Text4 [txt-color=#0000f0]Then[/txt-color] Text4.BackColor = vb3DShadow [txt-color=#0000f0]Else[/txt-color] Text4.BackColor = vbWhite
[txt-color=#0000f0] If[/txt-color] Me.ActiveControl [txt-color=#0000f0]Is [/txt-color]Text5 [txt-color=#0000f0]Then[/txt-color] Text5.BackColor = vb3DShadow [txt-color=#0000f0]Else[/txt-color] Text5.BackColor = vbWhite
[txt-color=#0000f0] If[/txt-color] Me.ActiveControl [txt-color=#0000f0]Is [/txt-color]Text6 [txt-color=#0000f0]Then[/txt-color] Text6.BackColor = vb3DShadow [txt-color=#0000f0]Else[/txt-color] Text6.BackColor = vbWhite
[txt-color=#0000f0] If[/txt-color] Me.ActiveControl [txt-color=#0000f0]Is [/txt-color]Text7 [txt-color=#0000f0]Then[/txt-color] Text7.BackColor = vb3DShadow [txt-color=#0000f0]Else[/txt-color] Text7.BackColor = vbWhite
[txt-color=#0000f0] If[/txt-color] Me.ActiveControl [txt-color=#0000f0]Is [/txt-color]Text8 [txt-color=#0000f0]Then[/txt-color] Text8.BackColor = vb3DShadow [txt-color=#0000f0]Else[/txt-color] Text8.BackColor = vbWhite
[txt-color=#0000f0] If[/txt-color] Me.ActiveControl [txt-color=#0000f0]Is [/txt-color]Text9 [txt-color=#0000f0]Then[/txt-color] Text9.BackColor = vb3DShadow [txt-color=#0000f0]Else[/txt-color] Text9.BackColor = vbWhite
[txt-color=#0000f0] If[/txt-color] Me.ActiveControl [txt-color=#0000f0]Is [/txt-color]Text10 [txt-color=#0000f0]Then[/txt-color] Text10.BackColor = vb3DShadow [txt-color=#0000f0]Else[/txt-color] Text10.BackColor = vbWhite
[txt-color=#0000f0] If[/txt-color] Me.ActiveControl [txt-color=#0000f0]Is [/txt-color]Text11 [txt-color=#0000f0]Then[/txt-color] Text11.BackColor = vb3DShadow [txt-color=#0000f0]Else[/txt-color] Text11.BackColor = vbWhite
[txt-color=#0000f0] If[/txt-color] Me.ActiveControl [txt-color=#0000f0]Is [/txt-color]Text12 [txt-color=#0000f0]Then[/txt-color] Text12.BackColor = vb3DShadow [txt-color=#0000f0]Else[/txt-color] Text12.BackColor = vbWhite
[txt-color=#0000f0] If[/txt-color] Me.ActiveControl [txt-color=#0000f0]Is [/txt-color]Text13 [txt-color=#0000f0]Then[/txt-color] Text13.BackColor = vb3DShadow [txt-color=#0000f0]Else[/txt-color] Text13.BackColor = vbWhite
[txt-color=#0000f0] If[/txt-color] Me.ActiveControl [txt-color=#0000f0]Is [/txt-color]Text14 [txt-color=#0000f0]Then[/txt-color] Text14.BackColor = vb3DShadow [txt-color=#0000f0]Else[/txt-color] Text14.BackColor = vbWhite
[txt-color=#0000f0] If[/txt-color] Me.ActiveControl [txt-color=#0000f0]Is [/txt-color]Text15 [txt-color=#0000f0]Then[/txt-color] Text15.BackColor = vb3DShadow [txt-color=#0000f0]Else[/txt-color] Text15.BackColor = vbWhite
[txt-color=#0000f0] If[/txt-color] Me.ActiveControl [txt-color=#0000f0]Is [/txt-color]Text16 [txt-color=#0000f0]Then[/txt-color] Text16.BackColor = vb3DShadow [txt-color=#0000f0]Else[/txt-color] Text16.BackColor = vbWhite
[txt-color=#0000f0]If[/txt-color] Me.ActiveControl [txt-color=#0000f0]Is[/txt-color] Text17 [txt-color=#0000f0]Then[/txt-color] Text17.BackColor = vb3DShadow [txt-color=#0000f0]Else[/txt-color] Text17.BackColor = vbWhite
[txt-color=#0000f0]End Sub[/txt-color]
ficou maior do que o dele, mas rodou sem problemas
valeu
                
            Eu testei com o código do Marcelo-Treze e deu um erro aqui.
então eu peguei o raciocÃnio dele e fiz assim:
Coloquei um Timer, Configurei seu Interval para 1
AÃ, dentro da Sub Timer1_Timer, eu segui o raciocÃnio do Marcelo-Treze e fiz:
[txt-color=#0000f0]Private Sub[/txt-color] Timer1_Timer()
[txt-color=#0000f0] If [/txt-color]Me.ActiveControl [txt-color=#0000f0]Is[/txt-color] Text1 [txt-color=#0000f0]Then[/txt-color] Text1.BackColor = vb3DShadow [txt-color=#0000f0]Else[/txt-color] Text1.BackColor = vbWhite
[txt-color=#0000f0] If[/txt-color] Me.ActiveControl [txt-color=#0000f0]Is [/txt-color]Text2 [txt-color=#0000f0]Then[/txt-color] Text2.BackColor = vb3DShadow [txt-color=#0000f0]Else[/txt-color] Text2.BackColor = vbWhite
[txt-color=#0000f0] If[/txt-color] Me.ActiveControl [txt-color=#0000f0]Is [/txt-color]Text3 [txt-color=#0000f0]Then[/txt-color] Text3.BackColor = vb3DShadow [txt-color=#0000f0]Else[/txt-color] Text3.BackColor = vbWhite
[txt-color=#0000f0] If[/txt-color] Me.ActiveControl [txt-color=#0000f0]Is [/txt-color]Text4 [txt-color=#0000f0]Then[/txt-color] Text4.BackColor = vb3DShadow [txt-color=#0000f0]Else[/txt-color] Text4.BackColor = vbWhite
[txt-color=#0000f0] If[/txt-color] Me.ActiveControl [txt-color=#0000f0]Is [/txt-color]Text5 [txt-color=#0000f0]Then[/txt-color] Text5.BackColor = vb3DShadow [txt-color=#0000f0]Else[/txt-color] Text5.BackColor = vbWhite
[txt-color=#0000f0] If[/txt-color] Me.ActiveControl [txt-color=#0000f0]Is [/txt-color]Text6 [txt-color=#0000f0]Then[/txt-color] Text6.BackColor = vb3DShadow [txt-color=#0000f0]Else[/txt-color] Text6.BackColor = vbWhite
[txt-color=#0000f0] If[/txt-color] Me.ActiveControl [txt-color=#0000f0]Is [/txt-color]Text7 [txt-color=#0000f0]Then[/txt-color] Text7.BackColor = vb3DShadow [txt-color=#0000f0]Else[/txt-color] Text7.BackColor = vbWhite
[txt-color=#0000f0] If[/txt-color] Me.ActiveControl [txt-color=#0000f0]Is [/txt-color]Text8 [txt-color=#0000f0]Then[/txt-color] Text8.BackColor = vb3DShadow [txt-color=#0000f0]Else[/txt-color] Text8.BackColor = vbWhite
[txt-color=#0000f0] If[/txt-color] Me.ActiveControl [txt-color=#0000f0]Is [/txt-color]Text9 [txt-color=#0000f0]Then[/txt-color] Text9.BackColor = vb3DShadow [txt-color=#0000f0]Else[/txt-color] Text9.BackColor = vbWhite
[txt-color=#0000f0] If[/txt-color] Me.ActiveControl [txt-color=#0000f0]Is [/txt-color]Text10 [txt-color=#0000f0]Then[/txt-color] Text10.BackColor = vb3DShadow [txt-color=#0000f0]Else[/txt-color] Text10.BackColor = vbWhite
[txt-color=#0000f0] If[/txt-color] Me.ActiveControl [txt-color=#0000f0]Is [/txt-color]Text11 [txt-color=#0000f0]Then[/txt-color] Text11.BackColor = vb3DShadow [txt-color=#0000f0]Else[/txt-color] Text11.BackColor = vbWhite
[txt-color=#0000f0] If[/txt-color] Me.ActiveControl [txt-color=#0000f0]Is [/txt-color]Text12 [txt-color=#0000f0]Then[/txt-color] Text12.BackColor = vb3DShadow [txt-color=#0000f0]Else[/txt-color] Text12.BackColor = vbWhite
[txt-color=#0000f0] If[/txt-color] Me.ActiveControl [txt-color=#0000f0]Is [/txt-color]Text13 [txt-color=#0000f0]Then[/txt-color] Text13.BackColor = vb3DShadow [txt-color=#0000f0]Else[/txt-color] Text13.BackColor = vbWhite
[txt-color=#0000f0] If[/txt-color] Me.ActiveControl [txt-color=#0000f0]Is [/txt-color]Text14 [txt-color=#0000f0]Then[/txt-color] Text14.BackColor = vb3DShadow [txt-color=#0000f0]Else[/txt-color] Text14.BackColor = vbWhite
[txt-color=#0000f0] If[/txt-color] Me.ActiveControl [txt-color=#0000f0]Is [/txt-color]Text15 [txt-color=#0000f0]Then[/txt-color] Text15.BackColor = vb3DShadow [txt-color=#0000f0]Else[/txt-color] Text15.BackColor = vbWhite
[txt-color=#0000f0] If[/txt-color] Me.ActiveControl [txt-color=#0000f0]Is [/txt-color]Text16 [txt-color=#0000f0]Then[/txt-color] Text16.BackColor = vb3DShadow [txt-color=#0000f0]Else[/txt-color] Text16.BackColor = vbWhite
[txt-color=#0000f0]If[/txt-color] Me.ActiveControl [txt-color=#0000f0]Is[/txt-color] Text17 [txt-color=#0000f0]Then[/txt-color] Text17.BackColor = vb3DShadow [txt-color=#0000f0]Else[/txt-color] Text17.BackColor = vbWhite
[txt-color=#0000f0]End Sub[/txt-color]
ficou maior do que o dele, mas rodou sem problemas
valeu
                    Qual foi o erro apresentado?
                
            
                    Olá Marcelo
Estava dizendo que o Objeto era requerido, mas deve ter sido erro de digitação meu.
Refiz seu exemplo e funcionou perfeitamante.
FAUSTOARAXA utilize o código do Marcelo.
Parabéns Marcelo
            Estava dizendo que o Objeto era requerido, mas deve ter sido erro de digitação meu.
Refiz seu exemplo e funcionou perfeitamante.
FAUSTOARAXA utilize o código do Marcelo.
Parabéns Marcelo
                        Tópico encerrado , respostas não são mais permitidas