Hello vb .net gurus
i'm trying to place a new data row at the bottom of the datagrid. i took this source code from an existing program that works fine but on the new program i doesn't do same as the existing program. could anyone help me out to see where the problem is occurring i have no idea. thanks
* i noticed at the "newrow = ref_frm_newdata.ds_element1.Element.LoadDataRow(elementdt, False)" line the row state is modified how to you change this to added?
i'm trying to place a new data row at the bottom of the datagrid. i took this source code from an existing program that works fine but on the new program i doesn't do same as the existing program. could anyone help me out to see where the problem is occurring i have no idea. thanks
VB.NET:
Private Sub cmd_saveelement_click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmd_saveelement.Click
Dim newrow As DataRow
elementdt(0) = ref_frm_newdata.dg_inputelement.VisibleRowCount
elementdt(1) = ref_frm_newdata.txt_customer.Text
elementdt(2) = ref_frm_newdata.txt_processno.Text
elementdt(3) = cb_elementname.SelectedValue
elementdt(4) = cb_materialcode.SelectedValue
If txt_gage.Text <> "" Then
elementdt(5) = CType(txt_gage.Text, System.Int32)
Else
elementdt(5) = 0.0
End If
If txt_ply.Text <> "" Then
elementdt(6) = CType(txt_ply.Text, System.Int32)
Else
elementdt(6) = 0
End If
If txt_pit.Text <> "" Then
elementdt(7) = CType(txt_pit.Text, System.Int32)
Else
elementdt(7) = 0
End If
If txt_wid.Text <> "" Then
elementdt(8) = CType(txt_wid.Text, System.Int32)
Else
elementdt(8) = 0
End If
elementdt(9) = 0.0
elementdt(10) = 0.0
ref_frm_newdata.ds_element1.Element.BeginLoadData()
newrow = ref_frm_newdata.ds_element1.Element.LoadDataRow(elementdt, False)
ref_frm_newdata.ds_element1.Element.EndLoadData()
ClearTextbox()
InitializeDataset()
End Sub
* i noticed at the "newrow = ref_frm_newdata.ds_element1.Element.LoadDataRow(elementdt, False)" line the row state is modified how to you change this to added?
Last edited: