Advertisement
idsystems

VBNETBD_Ejercicio19

Mar 12th, 2013
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VB.NET 1.35 KB | None | 0 0
  1. Imports System.Data
  2. Imports System.Data.OleDb
  3.  
  4. Public Class Form1
  5.     Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
  6.  
  7.         Dim cnn As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=peliculas.mdb; User Id=admin;Password=;")
  8.         Dim da As New OleDbDataAdapter("SELECT * FROM Peliculas", cnn)
  9.         Dim ds As New DataSet
  10.  
  11.         da.Fill(ds)
  12.  
  13.         DataGridView1.DataSource = ds.Tables(0)
  14.  
  15.     End Sub
  16.  
  17.     Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
  18.         Dim r As Integer
  19.         For r = 0 To DataGridView1.Rows.Count - 1 Step 2
  20.             DataGridView1.Rows(r).DefaultCellStyle.BackColor = Color.Pink
  21.         Next
  22.     End Sub
  23.  
  24.     Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
  25.         ' Solo la primer columna
  26.         DataGridView1.Columns(0).DefaultCellStyle.BackColor = Color.Yellow
  27.  
  28.     End Sub
  29.  
  30.     Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
  31.         DataGridView1.BackgroundColor = Color.Crimson
  32.  
  33.     End Sub
  34.  
  35.     Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
  36.         End
  37.     End Sub
  38. End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement