Ver Mensaje Individual
  #4 (permalink)  
Antiguo 15/03/2011, 07:38
darco1103
 
Fecha de Ingreso: marzo-2011
Ubicación: Colombia
Mensajes: 17
Antigüedad: 13 años, 11 meses
Puntos: 0
Respuesta: Datos duplicados en datagrid vb.net

Buenos dias... agradézco por sus respuestas, he llegado al siguiente código, pero todavia no me funciona, me puse a depurar el programa pero no me quiere entrar al condicional que tiene el mensaje... no sé si lo tengo bien escrito...help me!

NOTA: El datagrid1 se llama grilla_menu y el datagrid2 se llama grilla_dia


Código vb:
Ver original
  1. Private Sub grilla_menu_CellContentDoubleClick(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles grilla_menu.CellContentDoubleClick
  2.         Dim k As String
  3.         Dim tota, toot As Integer
  4.  
  5.         ' Se define una lista temporal de registro seleccionados
  6.        Dim rowSelected As New List(Of DataGridViewRow)()
  7.  
  8.         ' Se agrega el campo a la lista temporal
  9.        rowSelected.Add(grilla_menu.CurrentRow)
  10.  
  11.         ' Se agrega el item seleccionado a la grilla de destino
  12.        Dim existe = False
  13.         For Each row As DataGridViewRow In rowSelected
  14.             If Convert.ToString(row.Cells("Nombre Menu").Value).Equals(grilla_menu.CurrentRow) Then
  15.                 existe = True
  16.                 If (existe = True) Then
  17.                     MsgBox("Éste menú ya fué agregado", MsgBoxStyle.OkOnly, "INFORMACIÓN")
  18.                 Else
  19.                 End If
  20.  
  21.             End If
  22.             grilla_dia.Rows.Add(New Object() {False, row.Cells("Nombre Menu").Value, row.Cells("Valor").Value})
  23.  
  24.             toot = row.Cells("Valor").Value
  25.             tota = TextBox1.Text
  26.  
  27.             k = (toot + tota)
  28.  
  29.             TextBox1.Text = k
  30.         Next
  31.        
  32.     End Sub