Visual Basic.NET - Como recuperar el color de una de una grid una vez guardado

 
Vista:
sin imagen de perfil

Como recuperar el color de una de una grid una vez guardado

Publicado por Jose (23 intervenciones) el 29/09/2016 23:54:59
por que no se como mi columna es la 17 y 18 pero nose como decirle que me guarde el color que hay en esas columna??? Ayuda los datos los guardo de esta manera

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
Dim conexion1 As New SqlConnection(Rutina.CadenaConexion())
Dim cmd1 As New SqlCommand("INSERT INTO Quincena_II(id_deuda,id_Mes,[16],[17],[18],[19],[20],[21],[22],[23],[24],[25],[26],[27],[28],[29],[30],[31],Total)VALUES(@id_deuda,@id_Mes,ISNULL(@16,0),ISNULL(@17,0),ISNULL(@18,0),ISNULL(@19,0),ISNULL(@20,0),ISNULL(@21,0),ISNULL(@22,0),ISNULL(@23,0),ISNULL(@24,0),ISNULL(@25,0),ISNULL(@26,0),ISNULL(@27,0),ISNULL(@28,0),ISNULL(@29,0),ISNULL(@30,0),ISNULL(@31,0),(ISNULL(@16,0)+ISNULL(@17,0)+ISNULL(@18,0)+ISNULL(@19,0)+ISNULL(@20,0)+ISNULL(@21,0)+ISNULL(@22,0)+ISNULL(@23,0)+ISNULL(@24,0)+ISNULL(@25,0)+ISNULL(@26,0)+ISNULL(@27,0)+ISNULL(@28,0)+ISNULL(@29,0)+ISNULL(@30,0)+ISNULL(@31,0)))", conexion1)
 
Try
 
    cmd1.Parameters.Add("id_deuda", SqlDbType.Int)
    cmd1.Parameters("id_deuda").Value = Me.V_quincenaII.GetRowCellValue(Me.V_quincenaII.FocusedRowHandle, "id_deuda")
 
    cmd1.Parameters.Add("id_Mes", SqlDbType.Int)
    cmd1.Parameters("id_Mes").Value = cmbMes.EditValue
 
    cmd1.Parameters.Add("16", SqlDbType.Int)
    cmd1.Parameters("16").Value = Me.V_quincenaII.GetRowCellValue(Me.V_quincenaII.FocusedRowHandle, "16")
 
    cmd1.Parameters.Add("17", SqlDbType.Int)
    cmd1.Parameters("17").Value = Me.V_quincenaII.GetRowCellValue(Me.V_quincenaII.FocusedRowHandle, "17")
 
    cmd1.Parameters.Add("18", SqlDbType.Int)
    cmd1.Parameters("18").Value = Me.V_quincenaII.GetRowCellValue(Me.V_quincenaII.FocusedRowHandle, "18")
 
    cmd1.Parameters.Add("19", SqlDbType.Int)
    cmd1.Parameters("19").Value = Me.V_quincenaII.GetRowCellValue(Me.V_quincenaII.FocusedRowHandle, "19")
 
    cmd1.Parameters.Add("20", SqlDbType.Int)
    cmd1.Parameters("20").Value = Me.V_quincenaII.GetRowCellValue(Me.V_quincenaII.FocusedRowHandle, "20")
 
    cmd1.Parameters.Add("21", SqlDbType.Int)
    cmd1.Parameters("21").Value = Me.V_quincenaII.GetRowCellValue(Me.V_quincenaII.FocusedRowHandle, "21")
 
    cmd1.Parameters.Add("22", SqlDbType.Int)
    cmd1.Parameters("22").Value = Me.V_quincenaII.GetRowCellValue(Me.V_quincenaII.FocusedRowHandle, "22")
 
    cmd1.Parameters.Add("23", SqlDbType.Int)
    cmd1.Parameters("23").Value = Me.V_quincenaII.GetRowCellValue(Me.V_quincenaII.FocusedRowHandle, "23")
 
    cmd1.Parameters.Add("24", SqlDbType.Int)
    cmd1.Parameters("24").Value = Me.V_quincenaII.GetRowCellValue(Me.V_quincenaII.FocusedRowHandle, "24")
 
    cmd1.Parameters.Add("25", SqlDbType.Int)
    cmd1.Parameters("25").Value = Me.V_quincenaII.GetRowCellValue(Me.V_quincenaII.FocusedRowHandle, "25")
 
    cmd1.Parameters.Add("26", SqlDbType.Int)
    cmd1.Parameters("26").Value = Me.V_quincenaII.GetRowCellValue(Me.V_quincenaII.FocusedRowHandle, "26")
 
    cmd1.Parameters.Add("27", SqlDbType.Int)
    cmd1.Parameters("27").Value = Me.V_quincenaII.GetRowCellValue(Me.V_quincenaII.FocusedRowHandle, "27")
 
    cmd1.Parameters.Add("28", SqlDbType.Int)
    cmd1.Parameters("28").Value = Me.V_quincenaII.GetRowCellValue(Me.V_quincenaII.FocusedRowHandle, "28")
 
    cmd1.Parameters.Add("29", SqlDbType.Int)
    cmd1.Parameters("29").Value = Me.V_quincenaII.GetRowCellValue(Me.V_quincenaII.FocusedRowHandle, "29")
 
    cmd1.Parameters.Add("30", SqlDbType.Int)
    cmd1.Parameters("30").Value = Me.V_quincenaII.GetRowCellValue(Me.V_quincenaII.FocusedRowHandle, "30")
 
    cmd1.Parameters.Add("31", SqlDbType.Int)
    cmd1.Parameters("31").Value = Me.V_quincenaII.GetRowCellValue(Me.V_quincenaII.FocusedRowHandle, "31")
 
    cmd1.Parameters.Add("Total", SqlDbType.Int)
    cmd1.Parameters("Total").Value = Me.V_quincenaII.GetRowCellValue(Me.V_quincenaII.FocusedRowHandle, "Total")
 
    conexion1.Open()
    cmd1.ExecuteNonQuery()
    conexion1.Close()
    Me.G_quincenaII.DataSource = Deduccion.ListQuincena_II(Me.cmbMes.EditValue)
Catch ex As Exception
    conexion1.Close()
    MessageBox.Show(ex.Message)
End Try

y de esta manera pinto las columna

en el evento rowcellclick de GRIDVIEW DEV EXPRESS

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
If e.Column.AbsoluteIndex = 1 Then
    If cd.ShowDialog() = DialogResult.OK Then
        V_quincenaII.Columns(1).AppearanceCell.BackColor = cd.Color
        V_quincenaII.Columns(1).OptionsColumn.ReadOnly = True
        registrarColor(cd.Color.ToArgb)
    End If
End If
If e.Column.AbsoluteIndex = 2 Then
    If cd.ShowDialog() = DialogResult.OK Then
        V_quincenaII.Columns(2).AppearanceCell.BackColor = cd.Color
        V_quincenaII.Columns(2).OptionsColumn.ReadOnly = True
        registrarColor(cd.Color.ToArgb)
    End If
End If
If e.Column.AbsoluteIndex = 3 Then
    If cd.ShowDialog() = DialogResult.OK Then
        V_quincenaII.Columns(3).AppearanceCell.BackColor = cd.Color
        V_quincenaII.Columns(3).OptionsColumn.ReadOnly = True
        registrarColor(cd.Color.ToArgb)
    End If
End If
If e.Column.AbsoluteIndex = 4 Then
    If cd.ShowDialog() = DialogResult.OK Then
        V_quincenaII.Columns(4).AppearanceCell.BackColor = cd.Color
        V_quincenaII.Columns(4).OptionsColumn.ReadOnly = True
        registrarColor(cd.Color.ToArgb)
    End If
End If
If e.Column.AbsoluteIndex = 5 Then
    If cd.ShowDialog() = DialogResult.OK Then
        V_quincenaII.Columns(5).AppearanceCell.BackColor = cd.Color
        V_quincenaII.Columns(5).OptionsColumn.ReadOnly = True
        registrarColor(cd.Color.ToArgb)
    End If
End If
If e.Column.AbsoluteIndex = 6 Then
    If cd.ShowDialog() = DialogResult.OK Then
        V_quincenaII.Columns(6).AppearanceCell.BackColor = cd.Color
        V_quincenaII.Columns(6).OptionsColumn.ReadOnly = True
        registrarColor(cd.Color.ToArgb)
    End If
End If
If e.Column.AbsoluteIndex = 7 Then
    If cd.ShowDialog() = DialogResult.OK Then
        V_quincenaII.Columns(7).AppearanceCell.BackColor = cd.Color
        V_quincenaII.Columns(7).OptionsColumn.ReadOnly = True
        registrarColor(cd.Color.ToArgb)
    End If
End If
 
If e.Column.AbsoluteIndex = 8 Then
    If cd.ShowDialog() = DialogResult.OK Then
        V_quincenaII.Columns(8).AppearanceCell.BackColor = cd.Color
        V_quincenaII.Columns(8).OptionsColumn.ReadOnly = True
        registrarColor(cd.Color.ToArgb)
    End If
End If
 
If e.Column.AbsoluteIndex = 9 Then
    If cd.ShowDialog() = DialogResult.OK Then
        V_quincenaII.Columns(9).AppearanceCell.BackColor = cd.Color
        V_quincenaII.Columns(9).OptionsColumn.ReadOnly = True
        registrarColor(cd.Color.ToArgb)
    End If
End If
If e.Column.AbsoluteIndex = 10 Then
    If cd.ShowDialog() = DialogResult.OK Then
        V_quincenaII.Columns(10).AppearanceCell.BackColor = cd.Color
        V_quincenaII.Columns(10).OptionsColumn.ReadOnly = True
        registrarColor(cd.Color.ToArgb)
    End If
End If
If e.Column.AbsoluteIndex = 11 Then
    If cd.ShowDialog() = DialogResult.OK Then
        V_quincenaII.Columns(11).AppearanceCell.BackColor = cd.Color
        V_quincenaII.Columns(11).OptionsColumn.ReadOnly = True
        registrarColor(cd.Color.ToArgb)
    End If
End If
If e.Column.AbsoluteIndex = 12 Then
    If cd.ShowDialog() = DialogResult.OK Then
        V_quincenaII.Columns(12).AppearanceCell.BackColor = cd.Color
        V_quincenaII.Columns(12).OptionsColumn.ReadOnly = True
        registrarColor(cd.Color.ToArgb)
    End If
End If
If e.Column.AbsoluteIndex = 13 Then
    If cd.ShowDialog() = DialogResult.OK Then
        V_quincenaII.Columns(13).AppearanceCell.BackColor = cd.Color
        V_quincenaII.Columns(13).OptionsColumn.ReadOnly = True
        registrarColor(cd.Color.ToArgb)
    End If
End If
If e.Column.AbsoluteIndex = 14 Then
    If cd.ShowDialog() = DialogResult.OK Then
        V_quincenaII.Columns(14).AppearanceCell.BackColor = cd.Color
        V_quincenaII.Columns(14).OptionsColumn.ReadOnly = True
        registrarColor(cd.Color.ToArgb)
    End If
End If
If e.Column.AbsoluteIndex = 15 Then
    If cd.ShowDialog() = DialogResult.OK Then
        V_quincenaII.Columns(15).AppearanceCell.BackColor = cd.Color
        V_quincenaII.Columns(15).OptionsColumn.ReadOnly = True
        registrarColor(cd.Color.ToArgb)
    End If
End If
If e.Column.AbsoluteIndex = 16 Then
    If cd.ShowDialog() = DialogResult.OK Then
        V_quincenaII.Columns(16).AppearanceCell.BackColor = cd.Color
        V_quincenaII.Columns(16).OptionsColumn.ReadOnly = True
        registrarColor(cd.Color.ToArgb)
    End If
End If
End Sub

Seria de mucha ayuda si me ayuda y gracias nuevamente por su tiempo tomado
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder