0% found this document useful (0 votes)
88 views2 pages

Recorrer y Manipular DataGrid en VB.NET

The document provides code examples for: 1) Looping through rows and cells of a datagrid to retrieve cell values. 2) Creating a class with a boolean property and adding objects of that class to a list that is then bound to a datagrid. 3) Clicking a button that inserts data from textboxes and datetimepickers into a MySQL database table.

Uploaded by

fabyjs001
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
88 views2 pages

Recorrer y Manipular DataGrid en VB.NET

The document provides code examples for: 1) Looping through rows and cells of a datagrid to retrieve cell values. 2) Creating a class with a boolean property and adding objects of that class to a list that is then bound to a datagrid. 3) Clicking a button that inserts data from textboxes and datetimepickers into a MySQL database table.

Uploaded by

fabyjs001
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

'Recorrer los valores de una Columna Dim Valor As String Dim Col As Integer = [Link].

ColumnIndex For Each row As DataGridViewRow In [Link] Valor = [Link](Col).Value Next


Para recorrer las filas de un datagrid el cdigo seria algo asi: for(int i=0; i<[Link];i++) { for(int j=0; j<[Link][i].[Link]; j++) { string valor = [Link][i].Cells[j].Text; } }

Dim i As Integer For i = 0 To selectedRowCount - 1 'falta aca Next Dim x As Integer For x = 0 To [Link] Dim sel = [Link](x).Cells(0).Value() MsgBox("valor de la celda: " & sel) Next

Public Class Form1 Class persona Private xEstado As Boolean Public Property Estado() As Boolean Get Return xEstado End Get Set(ByVal value As Boolean) xEstado = value End Set End Property End Class

Private Sub Form1_Load(ByVal sender As [Link], ByVal e As [Link]) Handles [Link] Dim xPer1 As New persona Dim xPer2 As New persona [Link] = True [Link] = False Dim xPersonas As New List(Of persona) [Link](xPer1) [Link](xPer2) [Link] = xPersonas For index As Integer = 0 To [Link] - 1 Dim xValor As String = [Link](index).Cells(0).[Link]() [Link]("El valor es: " & xValor) Next End Sub End Class

Private Sub Button9_Click(ByVal sender As [Link], ByVal e As [Link]) Handles [Link] Dim conn As New MySqlConnection Dim myCommand As New MySqlCommand [Link] = myConnString [Link] = conn [Link] = ("INSERT INTO tallerbd.serv_preventivo (unidad, engrasado, motor, diferencial, transmision, comentario, quien) values ('" & [Link] & "', '" & Format([Link], "yyyy/MM/dd") & "', '" & Format([Link], "yyyy/MM/dd") & "', '" & Format([Link], "yyyy/MM/dd") & "', '" & Format([Link], "yyyy/MM/dd") & "', '" & [Link] & "')") Try [Link]() [Link]() MsgBox("GUARDADO") Catch myerror As MySqlException MsgBox("Error al actualizar la base de datos: " & [Link]) End Try End Sub

You might also like