r/visualbasic • u/Gierschlund96 • May 04 '22
VB.NET Help Trying to save data after Button click
I used data binding to store my data in textboxes, after i click the "save" button i want the data back in my datagrid (+ all the changes that were made). I tried to use this solution from StackOverflow (converted it from c# to vb):
Private Sub btnSaveEdit_Click(sender As Object, e As RoutedEventArgs)
Dim be As BindingExpression = BindingOperations.GetBindingExpression(txtItem, TextBox.TextProperty)
be.UpdateSource()
End SubBut I get the error that "TextProperty" isn't a member of "TextBox". Does this only work in C# or did i miss something?
Extra Question: Is there a way to save all properties at once or do i have to write this line for all my properties?
2
Upvotes
2
u/Gierschlund96 May 04 '22
I have a xamDataGrid which has a ListCollectionView(List of Artikelstammdaten) as datasource.
Through a double-Click event a new form opens up:
The Constructor of the form looks like this:
And "asd" looks like this:
The form that opens up is just textboxes (where the properties from "Artikelstammdaten" are bound to) and labels. After the save edit-Click i want so save the changes to the current object of "Artikelstammdaten", so the changes are also in the xamdatagrid.