Re: Excel VSTO Dialog Form
I took out the first
Code:
objfrmPromptForConnection.ShowDialog();
This seems to work for preventing the show twice but not the retreiving value problem, also the cursor is always set as the hourglass when on the dialog, can this be changed/ should it have to be?
Re: Excel VSTO Dialog Form
I dont know C# but reading a little about it made me ask you this question... :)
Also I have removed one extra bracket and added the 'dispose' line. Hope it is done that ways?
Code:
private void ThisWorkbook_Startup(object sender, System.EventArgs e)
{
frmPromptForConnection objfrmPromptForConnection;
objfrmPromptForConnection = new frmPromptForConnection();
objfrmPromptForConnection.Parent = this;
DAL.Connection = "Production";
if (objfrmPromptForConnection.ShowDialog() == DialogResult.OK)
{
// What does this give you
MessageBox.Show(objfrmPromptForConnection.Connection);
DAL.Connection = objfrmPromptForConnection.Connection;
}
Else
{
DAL.Connection = "Production";
}
objfrmPromptForConnection.Dispose();
}
Re: Excel VSTO Dialog Form
Well as suspected, the msgbox wasnt getting hit because the dialog result never got set to ok.
I thought by setting the forms OK property to the OK button would have been enough. I had to add
Code:
private void button1_Click(object sender, EventArgs e)
{
this.DialogResult = DialogResult.OK;
// Close();
}
For it to work. The workbook code could then access the forms properties without having to be set as parent.
So my final problem is why is the cursor set to Hourglass when the morm appears?
Re: Excel VSTO Dialog Form
Quote:
So my final problem is why is the cursor set to Hourglass when the morm appears?
Like I mentioned that I dont know C# so I googled it and got so many links that I got confused :lol: See if any of these make sense to you...
http://www.google.co.in/#hl=en&sourc...5c7405d4a7e2c8
also this
http://bytes.com/topic/c-sharp/answe...e-dialog-hangs
Re: Excel VSTO Dialog Form
I think there is somekind of override taking place.
If I set the form cursor to arrow then i get the arrow on most of the form now except for if I hover over a user control. I have tried setting the usercontrol to arrow but this doesnt take effect.