Beruflich Dokumente
Kultur Dokumente
Contedo
Estrutura da tabela.
Interface com o usurio
Codigo da Aplicacao.
figura 1.0
Para montar o formulrio acima descrito observe os seguintes passos:
1-Inicie um novo projeto no Visual Basic.Grave o formulrio Form1
como Fornecedores.
2-Adicione ao Form1 os objetos e configure as propriedades conforme
a tabela 1.0 abaixo :
Tabela 1.0 - Objetos e propriedades do formulrio Fornecedores
---------------------------------------------------------------------------Objeto
Propriedade
Configurao
---------------------------------------------------------------------------Form
Name
Fornecedores
Caption
"Cadastro de Fornecedores"
---------------------------------------------------------------------------TextBox
Name
Nome
Maxlength
30
---------------------------------------------------------------------------MaskedBox
Name
CGC
Mask
##.###.###/###-##
PrompInclude
False
PromptChar
""
---------------------------------------------------------------------------TextBox
Name
Endereco
Maxlength
30
---------------------------------------------------------------------------MaskedBox
Name
Cep
Mask
#####-###
PrompInclude
False
PromptChar
""
---------------------------------------------------------------------------TextBox
Name
UF
MaxLength
2
---------------------------------------------------------------------------TextBox
Name
DDD
MaxLength
4
---------------------------------------------------------------------------MaskedBox
Name
Fone
Mask
####-##-##
PrompInclude
False
PromptChar
""
---------------------------------------------------------------------------TextBox
Name
Ramal
MaxLength
4
---------------------------------------------------------------------------MaskedBox
Name
Fax
Mask
####-##-##
PrompInclude
False
PromptChar
""
---------------------------------------------------------------------------TextBox
Name
Contato
MaxLength
20
---------------------------------------------------------------------------TextBox
Name
Produto
MaxLength
20
---------------------------------------------------------------------------Frame
Caption
""
Name
Frame1
---------------------------------------------------------------------------CommandButton
Name
Inclui
Caption
"&Inclui"
--------------------------------------------------------------------------CommandButton
Name
Altera
Caption
"&Altera"
--------------------------------------------------------------------------CommandButton
Name
Exclui
Caption
"&Exclui"
--------------------------------------------------------------------------CommandButton
Name
Grava
Caption
"&Grava"
--------------------------------------------------------------------------CommandButton
Name
Cancela
Caption
"&Cancela"
--------------------------------------------------------------------------Frame
Caption
"Telefone/Contato/Produto"
Name
Frame2
--------------------------------------------------------------------------(*)CommandButton
Name
Command1(0)
Caption
"|<" CommandButton Name Command1(1) Caption "<" CommandButton Name Command1(2) Caption ">"
--------------------------------------------------------------------------CommandButton
Name
Command1(3)
Caption
">|"
--------------------------------------------------------------------------(**)Label
Caption
**
AutoSize
**
--------------------------------------------------------------------------(*)Constituem um "control array" - Controles com o mesmo nome e do mesmo
tipo, dotados de um ndice identificador.
(**)Todos os controles Label possuem a propriedade AutoSize=True e
Caption sendo igual ao nome do respectivo controle TextBox,MaskEdbox
ou CommandButton.
OBS - Voc tem que fazer referncia a DAO para poder criar seus objetos database.
Para referenciar a DAO em seu projeto :Veja a figura abaixo.
Contedo
Case MOVE_NEXT
tabela.MoveNext
If tabela.EOF Then tabela.MoveLast
Case MOVE_LAST
tabela.MoveLast
End Select
mostra_reg
End Sub
tabela.Edit
altera.Enabled = False
grava.Enabled = True
cancela.Enabled = True
exclui.Enabled = False
inclui.Enabled = False
nome.SetFocus
End Sub
cancela.Enabled = True
End Sub
ou
ramal = tabela![ramal]
Else
ramal = ""
End If
If Not IsNull(tabela![fax]) Then
fax = tabela![fax]
Else
fax = ""
End If
If Not IsNull(tabela![contato]) Then
contato = tabela![contato]
Else
contato = ""
End If
If Not IsNull(tabela![produto]) Then
produto = tabela![produto]
Else
produto = ""
End If
End Sub
for x=0 to 5
text1(x).text=""
next
Ou , de forma mais elegante, poderiamos criar uma rotina genrica:
Public Sub LimpaControles(tela as Form)
Dim i as integer
For i=0 to tela.controls-1
if TypeOf tela.Controls(i) is TextBox then
tela.Controls(i).text=""
endif
Next
End Sub
Exit Sub
Else
tabela.Seek "=", busca
End If
If Not tabela.NoMatch Then
mostra_reg
Else
MsgBox "Fornecedor no localizado ", vbExclamation, "Localiza"
tabela.Bookmark = marca
End If
End Sub
Contedo
Retorna