Solcito hay esta el codigo. de los dos formulario
Public Class frm_ingresar_orden
Inherits System.Windows.Forms.Form
Dim principal As frm_principal
Dim item_configuraciones As frm_item_configuracion
Dim funtions As New Functions
Dim items As DataSet
Dim titems As DataTable
Dim separador As DataSet
Dim tseparador As DataTable
Private Sub frm_ingresar_orden_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Try
funtions.cargar_clientes(Me.cb_cliente)
funtions.cargar_obras(Me.cb_proyecto, Nothing)
Catch ex As Exception
Throw ex
End Try
End Sub
Private Sub cb_cliente_SelectionChangeCommitted(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cb_cliente.SelectionChangeCommitted
If Me.cb_cliente.Items.Count > 0 Then
funtions.cargar_obras(Me.cb_proyecto, Me.cb_cliente.SelectedValue)
End If
End Sub
Private Sub frm_gestion_recibo_Closed(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Closed
Me.principal.v_orden_ingresar_orden = False
End Sub
'data swt para cargar los separadores a la orden
Public Function listado_separador() As DataSet
Dim separador_configuracion As New frm_separador_configuracion(Me.principal)
If IsNothing(separador) Then
separador = New DataSet("separador")
Dim cno_separador As New DataColumn("No Separador", GetType(String))
Dim ctipo As New DataColumn("Tipo", GetType(String))
Dim cmaterial As New DataColumn("Material", GetType(String))
Dim cespesor As New DataColumn("Espesor", GetType(String))
Dim cobservacion As New DataColumn("Observacion ", GetType(String))
tseparador = New DataTable("separador")
tseparador.Columns.Add(cno_separador)
tseparador.Columns.Add(ctipo)
tseparador.Columns.Add(cmaterial)
tseparador.Columns.Add(cespesor)
tseparador.Columns.Add(cobservacion)
separador.Tables.Add(tseparador)
End If
Dim nfila As DataRow
Try
nfila = tseparador.NewRow
nfila(0) = separador_configuracion.txt_separador_numero.Text
tseparador.Rows.Add(nfila)
tseparador.Rows(tseparador.Rows.Count - 1)(1) = separador_configuracion.cb_tipo.ValueMember
tseparador.Rows(tseparador.Rows.Count - 1)(2) = separador_configuracion.cb_material.ValueMember
tseparador.Rows(tseparador.Rows.Count - 1)(3) = separador_configuracion.cb_espesor.ValueMember
tseparador.Rows(tseparador.Rows.Count - 1)(4) = separador_configuracion.txt_separador_observacion.Text
Catch ex As Exception
separador.Clear()
Throw ex
End Try
Return separador
End Function
Private Sub btn_agregar_item_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn_agregar_item.Click
Dim item_configuracion As New frm_item_configuracion(Me.principal)
If Me.principal.v_item_configuracion = False Then
item_configuracion.MdiParent = Me.principal
Me.principal.v_item_configuracion = True
item_configuracion.Show()
Me.principal.sb_estado.Text = "Listo."
Else
Me.principal.sb_estado.Text = "La ventana ya se encuentra abierta."
End If
End Sub
Private Sub btn_agregar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn_agregar.Click
Dim vidrio_configuracion As New frm_vidrio_configuracion(Me.principal)
Dim separador_configuracion As New frm_separador_configuracion(Me.principal)
Dim principal As New frm_principal
Dim tvidrio As New DataTable
Dim tseparador As New DataTable
Try
If IsNothing(Me.dg_vidrio.DataSource) And IsNothing(Me.dg_separador.DataSource) Then
If Me.principal.v_vidrio_configuracion = False Then
vidrio_configuracion.MdiParent = Me.principal
Me.principal.v_vidrio_configuracion = True
vidrio_configuracion.Show()
Me.principal.sb_estado.Text = "Listo."
Else
Me.principal.sb_estado.Text = "La ventana ya se encuentra abierta."
End If
Else
If Me.principal.v_separador_configuracion = False Then
separador_configuracion.MdiParent = Me.principal
Me.principal.v_separador_configuracion = True
separador_configuracion.Show()
Me.principal.sb_estado.Text = "Listo."
Else
Me.principal.sb_estado.Text = "La ventana ya se encuentra abierta."
End If
End If
Catch ex As Exception
Me.principal.sb_estado.Text = "" & ex.Message
End Try
End Sub
End Class
-----------------------------------------------------------------------------------------------------------------------------------
Public Class frm_item_configuracion
Inherits System.Windows.Forms.Form
Dim principal As frm_principal
Private Sub frm_item_configuracion_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Functions.cargar_borde_acabado(Me.cb_borde_superior)
Functions.cargar_borde_acabado(Me.cb_borde_derecho)
Functions.cargar_borde_acabado(Me.cb_borde_inferior)
Functions.cargar_borde_acabado(Me.cb_borde_izquierdo)
Me.txt_boquetes.Text = 0
Me.txt_perforaciones.Text = 0
'Me.txt_item_numero.Text = Integer.Parse(Me.txt_item_numero.Text) + integer.Parse(ingresar_orden.dg_item.Item(ingresar_orden.dg_item.CurrentRowIndex, 0))
End Sub
Private Sub frm_gestion_recibo_Closed(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Closed
Me.principal.v_item_configuracion = False
End Sub
Private Sub btn_aceptar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn_aceptar.Click
Dim ingresar_orden As New frm_ingresar_orden(Me.principal)
Dim funtions As New Functions
If Me.txt_cantidad.Text <> "" And Me.txt_ancho.Text <> "" And Me.txt_largo.Text <> "" And Me.txt_item_observacion.Text <> "" And Me.txt_boquetes.Text <> "" And Me.txt_perforaciones.Text <> "" Then
Me.dg_item.SetDataBinding(Me.listado_items, "items")
Else
Me.principal.sb_estado.Text = "Debe llenar todos los campos."
End If
End Sub
Public Function listado_items() As DataSet
Dim item_configuracion As frm_item_configuracion
Dim items As DataSet
Dim titems As DataTable
If IsNothing(items) Then
items = New DataSet("items")
Dim cno_item As New DataColumn("No item", GetType(String))
Dim ccantidad As New DataColumn("Cantidad", GetType(String))
Dim cancho As New DataColumn("Ancho", GetType(String))
Dim clargo As New DataColumn("Largo", GetType(String))
Dim cobservacion As New DataColumn("Observacion ", GetType(String))
Dim cboquetes As New DataColumn("Boquetes", GetType(String))
Dim cperforaciones As New DataColumn("Perforaciones", GetType(String))
Dim cborde_superior As New DataColumn("B. Superior", GetType(String))
Dim cborde_derecho As New DataColumn("B. Derecho", GetType(String))
Dim cborde_inferior As New DataColumn("B. Inferior", GetType(String))
Dim cborde_izquierdo As New DataColumn("B. Izquierdo", GetType(String))
titems = New DataTable("items")
titems.Columns.Add(cno_item)
titems.Columns.Add(ccantidad)
titems.Columns.Add(cancho)
titems.Columns.Add(clargo)
titems.Columns.Add(cobservacion)
titems.Columns.Add(cboquetes)
titems.Columns.Add(cperforaciones)
titems.Columns.Add(cborde_superior)
titems.Columns.Add(cborde_derecho)
titems.Columns.Add(cborde_inferior)
titems.Columns.Add(cborde_izquierdo)
items.Tables.Add(titems)
End If
Dim nfila As DataRow
Try
nfila = titems.NewRow
nfila(0) = Integer.Parse(titems.Rows.Count) + 1
titems.Rows.Add(nfila)
titems.Rows(titems.Rows.Count - 1)(1) = Me.txt_cantidad.Text
titems.Rows(titems.Rows.Count - 1)(2) = Me.txt_ancho.Text
titems.Rows(titems.Rows.Count - 1)(3) = Me.txt_largo.Text
titems.Rows(titems.Rows.Count - 1)(4) = Me.txt_item_observacion.Text
titems.Rows(titems.Rows.Count - 1)(5) = Me.txt_boquetes.Text
titems.Rows(titems.Rows.Count - 1)(6) = Me.txt_perforaciones.Text
titems.Rows(titems.Rows.Count - 1)(7) = Me.cb_borde_superior.Text
titems.Rows(titems.Rows.Count - 1)(8) = Me.cb_borde_derecho.Text
titems.Rows(titems.Rows.Count - 1)(9) = Me.cb_borde_inferior.Text
titems.Rows(titems.Rows.Count - 1)(10) = Me.cb_borde_izquierdo.Text
Catch ex As Exception
items.Clear()
Throw ex
End Try
Return items
End Function
End Class