'VB.Net Function does not inherit textbox values from another class
I'm programming in a MVVM pattern and I have problems using textbox values in my function. When I call my function it does not use the values the user entered in the textbox. It is just empty. I looks like it inherits empty fields and just skips the filled in textbox fields. Please take a look at my code here
I call the addUser function from the AccountAddView here
Public Class AccountaddView
Public Sub btnAccountAdd_Click(sender As Object, e As RoutedEventArgs) Handles btnAccountAdd.Click
If txtPasswordAdd.Password <> txtPasswordAdd2.Password Then
warningLabel.Visibility = Visibility.Visible
Else
Dim model = New AccountaddModel()
model.addUser()
The functions triggers the Model
Public Class AccountaddModel
Inherits AccountaddViewModel
Public Function addUser()
Dim url As String = "https://azurefunctionsmywebsite" + "&name=" + username + "&pass=" + pass + "&role=" + role
Dim request As WebRequest = WebRequest.Create(url)
Dim response As WebResponse = request.GetResponse()
Dim result As String = New StreamReader(response.GetResponseStream()).ReadToEnd()
End Function
End Class
As you can see the Model inherits from the AccountAddViewModel. This class stores the variables that the user filled in the textbox
Public Class AccountaddViewModel
Inherits AccountaddView
Public username As String = txtUsernameAdd.Text
Public pass As String = txtPasswordAdd.Password
Public role As String = txtProjectrolAdd.Text
End Class
I have no errors. When I fill in the username,pass and role as an user the URL in the function does not fill it with the data. It is just empty.
I hope someone can help me out with this inheritance issue.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
