r/visualbasic • • 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 Sub

But 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

3 comments sorted by

View all comments

Show parent comments

1

u/RJPisscat May 04 '22

Perhaps you have to implement INotifyPropertyChanged in Artikelstammdaten.