btn_Apply_Click not changing variables.

So I am creating a program for a friend at his work as one of my projects, and I have most of it sorted out. I'm stuck though on the click property of a button, where I'm trying to change a variable to whatever a current selection in a combo box is on when I click the apply button.
6 Replies
Angius
Angius2y ago
$details
MODiX
MODiX2y ago
When you ask a question, make sure you include as much detail as possible. Such as code, the issue you are facing, and what you expect the result to be. Upload code here https://paste.mod.gg/ (see $code for more information on how to paste your code)
necrosisbyte
necrosisbyteOP2y ago
$code
MODiX
MODiX2y ago
To post C# code type the following: ```cs // code here ``` Get an example by typing $codegif in chat If your code is too long, post it to: https://paste.mod.gg/
necrosisbyte
necrosisbyteOP2y ago
https://paste.mod.gg/xogaamxzabyp/3 The specific part I am having trouble with is in Form1.cs.
private void btn_Apply_Click(object sender, EventArgs e)
{

TimeSelector.HourSelector = cb_sdHour.Items[cb_sdHour.SelectedIndex].ToString();
TimeSelector.MinuteSelector = cb_sdMinute.Items[cb_sdMinute.SelectedIndex].ToString();
TimeSelector.AmPmBuffer = cb_sdAmPm.Items[cb_sdAmPm.SelectedIndex].ToString();

lbl_shutdownHour.Refresh();
}
private void btn_Apply_Click(object sender, EventArgs e)
{

TimeSelector.HourSelector = cb_sdHour.Items[cb_sdHour.SelectedIndex].ToString();
TimeSelector.MinuteSelector = cb_sdMinute.Items[cb_sdMinute.SelectedIndex].ToString();
TimeSelector.AmPmBuffer = cb_sdAmPm.Items[cb_sdAmPm.SelectedIndex].ToString();

lbl_shutdownHour.Refresh();
}
BlazeBin - xogaamxzabyp
A tool for sharing your source code with the world!
necrosisbyte
necrosisbyteOP2y ago
So when you click the apply button it is supposed to change the variable of the time selector to whatever the current selected item is in the three combo boxes. And in turn change the display numbers as well to reflect the change. However, when I click apply, neither of them change.
Want results from more Discord servers?
Add your server