Quote:
From Form1:
private void bSave_Click(object sender, EventArgs e)
{
SaveQueryAs save = new SaveQueryAs(ref str);
save.ShowDialog();
}
---
To form SaveQueryAs:
public partial class SaveQueryAs : Form
{
string sRef = null;
public SaveQueryAs(ref string str)
{
InitializeComponent();
bOK.DialogResult = DialogResult.OK;
sRef = str; //or str = sRef. Tried both
}
and later on when the form closes:
private void bOK_Click(object sender, EventArgs e)
{
sRef = "Whatever";
}
It doesnt change the string back to the caller. I guess the new value can only be assigned in that method that takes the ref parameter, but this can't be done as you see.