Aqui aprenderemos a crear algo asi como agenda de refranes, donde al ejecutarlo los refranes pasaran por si solos cada cierto tiempo..espero que les guste..obviamente tnbm echo en capas..
como veran es programacion avanzada.
En la capa cliente Imports Prj_capa_negocio Public Class Frm_refranes Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick Txt_time.Text = ProgressBar1.Value ProgressBar1.Increment(1) If ProgressBar1.Value = ProgressBar1.Maximum Then Timer1.Start() End If End Sub Private Sub Frm_refranes_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Timer1.Start() End Sub Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Txt_time.TextChanged Dim obj As New RN_refran Dim datos As New DataTable datos = obj.RN_pasar_refranes(Txt_time.Text) Try Txt_refran.Text = datos.Rows(0)("REFRAN") Txt_significado.Text = datos.Rows(0)("SIGNIFICADO") Txt_autor.Text = datos.Rows(0)("AUTOR") Catch ex As Exception End Try End Sub End Class EN LA CAPA DATOS Imports System.Data.SqlClient Public Class BD_refran Public Function BD_pasar_refranes(ByVal xid As String) As DataTable Dim cn As New SqlConnection Try cn.ConnectionString = obtener_conexion() Dim DA As New SqlDataAdapter("sp_ver_refranes", cn) DA.SelectCommand.CommandType = CommandType.StoredProcedure DA.SelectCommand.Parameters.AddWithValue("@id", xid) Dim datos As New DataTable DA.Fill(datos) DA = Nothing Return datos Catch ex As Exception If cn.State = ConnectionState.Open Then cn.Close() MsgBox("error" & ex.Message) Return Nothing End Try End Function End Class EN LA CAPA NEGOCIO Imports Prj_capa_datos Public Class RN_refran Public Function RN_pasar_refranes(ByVal xid As String) As DataTable Dim obj As New BD_refran Return obj.BD_pasar_refranes(xid) End Function End Class: