text boxes reverting to pre edit values?
I have written some code to get the data from a number of text boxes all named in the style txb_[column name]
I want to write this data to a datatable.
The text boxes were initially filled using a row 'aIndex' from the datatable, then the user can edit the data.
When this code runs, the text boxes all revert to their initial values, regardless of any changes made to their contents during runtime.
Code:
'save data to table
For Each c As Control In Me.MyPanel.Controls
If c.Name.StartsWith("txb_") Then
col_Name = c.Name.Substring(4)
Select Case MyTable.Columns(col_Name).DataType.ToString ' check if it's a string
Case "System.String"
MyTable.Rows(aIndex)(col_Name) = c.Text
Case Else
Console.WriteLine(" Column " & col_Name & " is not a string")
End Select
End If
Next
I want to update the table with the new data. Any ideas?
TIA
H
I'm using .NET Framework 3.5
I'm planning to be spontaneous tomorrow