Вы находитесь на странице: 1из 2

Public Class Form1 Dim cn As New OleDb.OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Users\Alumnos\Documents\Usuariosd.

accdb") Dim fila As Integer = 1 Dim dt As New DataTable Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim encontrado = 0 fila = 0 Do While (fila <= dt.Rows.Count - 1) If (TextBox1.Text = dt.Rows(fila)("Nombre")) Then MsgBox("Nombre Encontrado" + TextBox1.Text) encontrado = 1 End If fila = fila + 1 Loop If encontrado = 0 Then MsgBox("Nombre no encontrado") End If End Sub Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load cn.Open() Dim datos As String = "Select*from Usuario" Dim dataAdapter As New OleDb.OleDbDataAdapter(datos, cn) dataAdapter.Fill(dt) dataAdapter.Dispose() cn.Close() End Sub

End Class

Public Class Form1

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click ListBox1.Items.Add(TextBox1.Text) TextBox1.Text = " " TextBox1.Focus() End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click Dim a(5) As Integer Dim temp As Integer Dim x As Integer For x = 0 To 4 a(x) = ListBox1.Items.Item(x) Next x For x = 0 To 4 For y = 0 To 3 If (a(y) >= a(y + 1)) Then temp = a(y) a(y) = a(y + 1) a(y + 1) = temp End If Next y Next x For x = 0 To 4 ListBox2.Items.Add(a(x))

Next x End Sub End Class

Вам также может понравиться