❔ Damn buttons.
I want a button on a WinForm to change varibles to whatever the combobox has selected when the button is clicked. Is this the right format for this?
Basically change the three variables, then refresh the label showing those variables?
15 Replies
Every other part of the code has been tested and works as it should.
@Necro so applying variables doesnt work right?
Okay so I got that to work, my problem has changed. So I now have to click the button twice for the change to take effect. In debug when I step through it happens on the first click, but when I just ctrl f5 it, it takes two clicks.
could you send more code?
Sure one sec.
BlazeBin - gnuwjeyrqxgi
A tool for sharing your source code with the world!
That's the project in whole, it's pretty small.
So when I click apply the text up top should change to whatever the combo boxes are set to, and they do, but I have to click apply twice for it to happen.
I think I got it. I have to call the
Displays
with the button click and not rely on the timer refresh.Well Idk why it doesnt work but i would recommend you creating a new class and add to this
public timespan hours { get; set; }
And minutes and seconds
In your class where you code the buttons import it using
MyClass _myClass
And use OnPropertyChanged()
You gotta make a observableobject class Just copy from the Google its always the same
@Necro you are not setting the values in the Display class but in the TimeSelector upon clicking the button
Then you set the label to a concatenated string which you build from the values in your Display class
So because you never changed the values within Display it won’t show you the correct new time
OnPropertychanged isn’t useful for winforms.
you mean
ObservableObject
from the MVVM Community Toolkit?
i've never heard of this in WinForms, that's why I'm askingNope onpropertychanged func
OnPropertychanged isn’t useful for winforms.This. While it might work, setting up bindings in WinForms is a big pain
xd
@Ryada *ngIf="exists" Thank you that worked. I needed to rebuild the display class to update the values to equal the new TimeSelector values.
Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.