Vote count:
0
I am trying to pass the .SelectedText
(preferably) or the .SelectedItem
from a ComboBox on my main form DetailerReports to my logic class Math.cs. I've been working and searching for several hours now and I'm hoping someone will direct me further. I have been passing from Math to DetailerReport, but not the other way around so I thought it would be similar. I've tried several options though I think this is the closest but not currently functioning solution. I'm declaring the parameter publicly and trying to assign the value when the SelectedIndexChanged event is triggered for cbSelectProject
comboBox
public partial class DetailerReports : Form
{
public string cbSelectedProjectValue = "";
public void cbSelectProject_SelectedIndexChanged(object sender, EventArgs e)
{
if (cbSelectedProjectValue == "")
{
cbSelectedProjectValue = cbSelectProject.SelectedText;
MessageBox.Show(cbSelectedProjectValue);
}
//return cbSelectedProjectValue;
}
}
I was hoping to return the value cbSelectedProjectValue
and pass that to my Math.cs
for use as a variable
string cbSelectProjectValue = DetailerReports.cbSelectProject_SelectedIndexChanged();
or
string cbSelectProjectValue = DetailerReport.cbSelectedProjectValue;
Neither of these is working. If anyone can please point me in the right direction I would be very grateful. Thank You in advance for your time and consideration. Have a Great Day!! :-D
Pass the ComboBox.SelectedText parameter to another class
Aucun commentaire:
Enregistrer un commentaire