Updating data in a Datatable

  • Thread starter Thread starter NachoShaw
  • Start date Start date
N

NachoShaw

Guest
Hey

i have created a simple datatable to store data that i collect from a XML file. The datatable has 2 columns (PropName, PropValue) and its purpose it help me organise data that i add to inventor files.

I can filter the table but how can i find and update a row? for example:

Create the table

Friend Sub CreateBlockDataTable()
BlockData.Columns.Add("PropertyName", GetType(String))
BlockData.Columns.Add("PropertyValue", GetType(String))
End Sub

Add data to the table

AddinGlobal.FrmLoader.Tables.BlockData.Rows.Add(New Object() {"OP PRESS", OP_PRESS})
AddinGlobal.FrmLoader.Tables.BlockData.Rows.Add(New Object() {"OP TEMP", OP_TEMP})
AddinGlobal.FrmLoader.Tables.BlockData.Rows.Add(New Object() {"headTHK", headTHK})
AddinGlobal.FrmLoader.Tables.BlockData.Rows.Add(New Object() {"RT_NP", RT_NP})
AddinGlobal.FrmLoader.Tables.BlockData.Rows.Add(New Object() {"Head_Type", Head_Type})

populate textboxes

Dim d As New Data
d.PopulateBlockData()
For Each r As DataRow In AddinGlobal.FrmLoader.Tables.BlockData.Rows
Dim prop As String = r(0)
Dim val As String = r(1)

Select Case r(0)
Case "OP PRESS"
AddinGlobal.FrmLoader.UsrLoad.TxtOPPRESS.Text = r(1)
Case "OP TEMP"
AddinGlobal.FrmLoader.UsrLoad.TxtOPTEMP.Text = r(1)
Case "headTHK"
AddinGlobal.FrmLoader.UsrLoad.TxtheadTHK.Text = r(1)
Case "RT_NP"
AddinGlobal.FrmLoader.UsrLoad.TxtRTNP.Text = r(1)
Case "Head_Type"
AddinGlobal.FrmLoader.UsrLoad.TxtheadType.Text = r(1)
Next

if i needed to update the headTHK value that is in the table from a textbox value, how can i do that?

Thanks



I am here to ask questions and learn from others. Cor Ligthert DO NOT REPLY TO ANY OF MY POSTS!!

Continue reading...
 
Back
Top