I have two issues with a method I am calling.
I have frmForm1 & frmForm2.
frmForm1 contains a method as below...
public frmForm1()
{
InitializeComponent();
}
//This method receives the prog name and WOtype names from frmForm2
int progID;
string programName;
public void GetIDandValue(string valName, int ID, string addWOValue)
{
if (valName == "progName")
{
progID = ID;
programName = addWOValue;
}
}
private void button1_Click(object sender, EventArgs e)
{
frmForm2 loadfrmForm2 = new frmForm2();
loadfrmForm2.Show();
}
Then from frmForm2 (which is opened from a btn click on frmForm1), I am trying to send values back to the method on frmForm1 so they can be used.
private void button1_Click(object sender, EventArgs e)
{
selectedValueID = Int32.Parse(comboBox1.ValueMember);
selectedValueName = comboBox1.DisplayMember;
string valToSend = "progName";
frmForm1.GetIDandValue(valToSend, selectedValueID, selectedValueName);
this.Hide();
}
And finally, here's how combobox1 is being initialised...
comboBox1.DisplayMember = dsAddWO.Tables[0].Columns[1].ToString();
comboBox1.ValueMember = dsAddWO.Tables[0].Columns[0].ToString();
comboBox1.DataSource = dsAddWO.Tables[0];
comboBox1.Enabled = true;
Problem 1) combobox1 ValueMember and Displaymember are returning the column headers as values when i try to populate the variables (although the correct data is actually displaying in the combobox on the form).
Problem 2) I cant seem to call the GetIDandValue method from frmForm2, intellisense just doesnt see it.
No doubt im doing something incredibly stupid. Can anyone enlighten me?