Usuário com melhor resposta
VB 2010 Access Database Buttons Before and Next

Pergunta
-
I have a form with a text box and two masked boxes. They show the name, cell phone and telephone that are stored in a registry of database Access 2007.
The database have the fields Code (self numeration), Name, Telephone and Cell.
When I execute the form, it shows the data in textbox and in masked boxes. They refer to the registry order by Name in alphabetical order.
I would like that, when I click the buttons Next and Before, they show the content of the next and the before registry.
I am starter and I ask you send me the codes that refer to the buttons next and before.
Thank you.
At the moment, my code is like this:
Imports System.Data.OleDb
Public Class frmAgenda
Private Sub frmAgenda_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
Dim con As New OleDbConnection
con.ConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source='|DataDirectory|\Agenda Database.accdb'"
con.Open()
Dim comand As New OleDbCommand
comand.CommandText = "SELECT TOP 1 * FROM tb_dados ORDER BY Name"
comand.CommandType = CommandType.Text
comand.Connection = con
Dim reader As OleDbDataReader
reader = comand.ExecuteReader()
reader.Read()
Me.txtNome.Text = reader("Nome").ToString
Me.mskCelular.Text = reader("Cell").ToString
Me.mskTelefone.Text = reader("Telephone").ToString
End Sub
Private Sub btnNext_Click(sender As System.Object, e As System.EventArgs) Handles btnNext.Click
Dim con As New OleDbConnection
con.ConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source='|DataDirectory|\Agenda Database.accdb'"
Dim comand As New OleDbCommand
End Sub
Private Sub btnBefore_Click(sender As System.Object, e As System.EventArgs) Handles btnBefore.Click
Dim con As New OleDbConnectioncon.ConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source='|DataDirectory|\Agenda Database.accdb'"
Dim comand As New OleDbCommand
End Sub
End Class
- Editado anderson ferreira diniz quinta-feira, 22 de dezembro de 2011 06:49
Respostas
-
Através da video aula 24 do curso Visual Basic Avançado da Treinamentos TI, aprendi que o código fica da seguinte forma:
Private Sub btnProximo_Click(sender As System.Object, e As System.EventArgs) Handles btnProximo.Click
Me.Tb_dadosBindingSource.MoveNext()
End Sub
Private Sub btnAnterior_Click(sender As System.Object, e As System.EventArgs) Handles btnAnterior.Click
Me.Tb_dadosBindingSource.MovePrevious()
End Sub
- Marcado como Resposta anderson ferreira diniz sexta-feira, 23 de dezembro de 2011 04:36
Todas as Respostas
-
Estas a brincar anderson?
Estas a duplicar as peruntas porque?
http://social.msdn.microsoft.com/Forums/en-US/adoptpt/thread/9f451e2d-4ab6-479e-95ed-4ca6799457b8
One word frees us of all the weight and pain of life: that word is love. -
-
Olá Anderson,
Veja o exemplo que coloquei neste link: https://skydrive.live.com/#cid=7DECE45BBF0DB70F&id=7DECE45BBF0DB70F!660
Ele se chama WindowsPreviousNext.zip
[]s!
Fernando Henrique Inocêncio Borba Ferreira
while(alive){ this.WriteCode(); }
Blog: http://ferhenriquef.wordpress.com/
Twitter: @ferhenrique -
Quando quiser postar uma pergunta em inglês utilize o fórum em inglês, vc pode acessa-lo por aqui: http://social.msdn.microsoft.com/Forums/en-us/adonetefx/threads
[]s!
Fernando Henrique Inocêncio Borba Ferreira
while(alive){ this.WriteCode(); }
Blog: http://ferhenriquef.wordpress.com/
Twitter: @ferhenrique -
Através da video aula 24 do curso Visual Basic Avançado da Treinamentos TI, aprendi que o código fica da seguinte forma:
Private Sub btnProximo_Click(sender As System.Object, e As System.EventArgs) Handles btnProximo.Click
Me.Tb_dadosBindingSource.MoveNext()
End Sub
Private Sub btnAnterior_Click(sender As System.Object, e As System.EventArgs) Handles btnAnterior.Click
Me.Tb_dadosBindingSource.MovePrevious()
End Sub
- Marcado como Resposta anderson ferreira diniz sexta-feira, 23 de dezembro de 2011 04:36