Problem with panel and form inside other form and datagridview

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • AFB

    #1

    Problem with panel and form inside other form and datagridview

    Hi:
    I have a form called "Form1" and another called "Form2".
    I have a panel in Form1 and I add to the panel the Form2.

    The code is something like...

    Dim FormuGestorProy ectos As From2
    FormuGestorProy ectos = New FGESTORPROYECTO S
    FormuGestorProy ectos.TopLevel = False
    FormuGestorProy ectos.Dock = DockStyle.Fill
    Me.PanelFormula rios.Controls.A dd(FormuGestorP royectos)
    FormuGestorProy ectos.Show()
    FormuGestorProy ectos.BringToFr ont()

    It works Ok but in the Form2 I have a datagridview. Two of the columns of
    the datagridview are not binding columns and I calculate it on the form load
    event of the form2.

    If a put a messagebox at the end of the form load of the form2 while I don't
    push the ok buttom I see the form2 into the form1 ok but when I click the OK
    buttom of the messagebox the values of the not bingind columns are losed....
    why???
    Here you are the code of the form2 load event:

    Private Sub FGESTORPROYECTO S_Load(ByVal sender As System.Object, ByVal e As
    System.EventArg s) Handles MyBase.Load

    Me.TAProyectos. FillByESTADO(Me .DsGestorProyec tos1.Proyectos, "0000000001 ")
    ActualizaGrid()
    MessageBox.Show (Me.DGProyectos .SelectedRows(0 ).Cells(12).Val ue)

    End Sub

    Sub ActualizaGrid()
    Dim Fila As DataGridViewRow
    For Each Fila In Me.DGProyectos. Rows
    'BProgreso
    If Fila.Cells(10). Value 100 Then
    Fila.Cells(4).V alue = 100
    Else
    Fila.Cells(4).V alue = Fila.Cells(10). Value
    End If
    'Ratio
    If IsDBNull(Fila.C ells(10).Value) Or IsDBNull(Fila.C ells(11).Value)
    Then
    Fila.Cells(12). Value = 0
    Else
    Fila.Cells(12). Value = Fila.Cells(10). Value /
    Fila.Cells(11). Value
    End If
    Next
    End Sub

    If I use the form2 at the startup form It works fine..

    What is happend???

    Thanks a lot.


Working...