I'm trying to get the original Value of an DataRow. The DataRow is containing a list of files with some information about them... The Rows where shown on a DataGridView...
Now I want to make the filenames renameable, for that purpose I need to get the Original Value of the edited cell(containing the name) and the current(after edit)...
This is my code until Now...
Private Property Manager As MetroStyleManager
Private WithEvents Data As New DataTable
Private WithEvents Binding As New BindingSource
Public Sub New(ByVal styleManager As MetroStyleManager)
Me.Manager = styleManager
InitializeComponent()
End Sub
Private Sub Register_Manager_Load() Handles MyBase.Load
Me.StyleManager = Manager
Register_Tabs.ButtonStyleManager = Manager
Load_Design()
Load_Sources()
Load_Registers()
End Sub
Private Sub Load_Design()
If My.Settings.Main_DarkMode Then
Manager.Theme = MetroThemeStyle.Dark
Manager.Style = MetroColorStyle.Blue
Else
Manager.Theme = MetroThemeStyle.Light
Manager.Style = MetroColorStyle.Green
End If
End Sub
Private Sub Load_Sources()
Data.Columns.Add("Register Name", GetType(String))
Data.Columns.Add("Enties", GetType(Int64))
Data.Columns.Add("Last Edit", GetType(DateTime))
Data.Columns.Add("Size (Mb)", GetType(String))
Data.AcceptChanges()
Binding.DataSource = Data
Register_Grid.DataSource = Binding
Register_Grid.Columns(0).ReadOnly = False
Register_Grid.Columns(0).AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill
Register_Grid.Columns(1).ReadOnly = True
Register_Grid.Columns(1).AutoSizeMode = DataGridViewAutoSizeColumnMode.ColumnHeader
Register_Grid.Columns(2).ReadOnly = True
Register_Grid.Columns(2).AutoSizeMode = DataGridViewAutoSizeColumnMode.None
Register_Grid.Columns(2).Width = 150
Register_Grid.Columns(3).ReadOnly = True
Register_Grid.Columns(3).AutoSizeMode = DataGridViewAutoSizeColumnMode.ColumnHeader
End Sub
Private Sub Load_Registers()
Dim directoy = Application.StartupPath()
For Each f In New IO.DirectoryInfo(directoy & "\register").GetFiles("*.csv")
Dim name As String = f.Name
Dim edit As String = f.LastWriteTime
Dim entries As Int64 = File.ReadAllLines(f.FullName).Length - 1
Dim size As Decimal = f.Length
Data.Rows.Add(name, entries, edit, size.ToString("F3"))
Next
End Sub
Edit1 I would prefer using the RowStates to handel also deleting Rows (files have to get deleted too then)
What I have tried:
I searched for about 10 hours for an solution... And used many snippets, Nothing worked or returned any values except of "Nothing" values...
Most of the snippets were using the DataRowState or DataViewRowState Properties, but they seem to be not working with my DataTable...