LIMPAR TODOS OS TEXTBOX DE UMA VEZ

RODEOLIVEIRA 15/01/2011 18:24:47
#362370
Olá a todos....


Outra Função do VB6 para o VB2010...

Eu usava uma função para dar um Clear ou [Ô][Ô] para todos os controles texts e outros.... mas em VS2010 não esta funcionando, principalmente em controles que não são nativos do VB...

VB6
Public Sub ClearText(FormName As Form)
Dim FormControleText As Control
Dim sOldMask As String
For Each FormControleText In FormName.Controls
If TypeOf FormControleText Is TextBox Then FormControleText = Clear
If TypeOf FormControleText Is CheckBox Then FormControleText.Value = 0
If TypeOf FormControleText Is OptionButton Then FormControleText.Value = False
If TypeOf FormControleText Is Image Then
If FormControleText.Name <> [Ô]ImgCabeçalho[Ô] Then
FormControleText.Picture = LoadPicture()
End If
End If
If TypeOf FormControleText Is ComboBox Then FormControleText.Text = [Ô][Ô]
If TypeOf FormControleText Is RibaCaixaControl Then
If (FormControleText.TipoDados >= 2 And FormControleText.TipoDados <= 8) Or (FormControleText.TipoDados = 17) Then
FormControleText = 0
Else
FormControleText = Clear
End If
End If
If TypeOf FormControleText Is MaskEdBox Then
sOldMask = FormControleText.Mask
FormControleText.Mask = [Ô][Ô]
FormControleText = Clear
FormControleText.Mask = sOldMask
End If
Next FormControleText
End Sub

VS2010
Public Sub LimpaControles(ByVal FormName As Form)
Dim FormControleText As Control
[ô] Dim sOldMask As String
For Each FormControleText In FormName.Controls
If TypeOf FormControleText Is TextBox Then FormControleText.Text = [Ô][Ô]
[ô] If TypeOf FormControleText Is CheckBox Then FormControleText.Value = 0
[ô]If TypeOf FormControleText Is OptionButton Then FormControleText.Value = False
[ô]If TypeOf FormControleText Is Image Then
[ô]FormControleText.Picture = LoadPicture()
[ô]End If
If TypeOf FormControleText Is ComboBox Then FormControleText.Text = [Ô][Ô]
If TypeOf FormControleText Is CaixaTextoRodrigo.CaixaRodrigo Then
FormControleText.Text = [Ô][Ô]
End If

[ô] If TypeOf FormControleText Is MaskEdBox Then
[ô] sOldMask = FormControleText.Mask
[ô] FormControleText.Mask = [Ô][Ô]
[ô] FormControleText = Clear
[ô] FormControleText.Mask = sOldMask
[ô] End If
Next FormControleText

End Sub
RODRIGOFERRO 15/01/2011 18:31:51
#362372
Resposta escolhida
Migão boa tarde, tem dezenas de funções destas na net, essas aqui catei no forum mesmo, da uma olhada ai !

http://www.vbmania.com.br/pages/index.php?varModulo=Forum&varMethod=abrir&varID=359580&varWorld=
http://www.vbmania.com.br/pages/index.php?varModulo=Detalhe&varID=8154

Limpar

Abraços
Tópico encerrado , respostas não são mais permitidas