Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Calling forms in C# dll 1

Status
Not open for further replies.

AgentM

MIS
Jun 6, 2001
387
US
Hi,

I have a C# dll, that needs to call a form.
I have included the form as a separate class in the dll.

But when I use formName.Visible in the dll, it frozes, the form details are not shown.

Any idea why?

Thank you.
 
Here it goes :-

<CODE>
1 - The Dll
InputBox.cs
namespace MsgBox
{
public class InputBox
{
private string _textValue;
public string textValue
{
get { return _textValue; }

set { _textValue = value; }

}

public string GetTextValue()
{
InputForm clsForm = new InputForm();
clsForm.Visible = true;
clsForm.Show();

return _textValue;

}
}
}

2. The Form in the dll

Form.Cs
namespace MsgBox
{
public partial class InputForm : Form
{
InputBox Box = new InputBox();
public InputForm()
{
InitializeComponent();
}

private void btnOk_Click(object sender, EventArgs e)
{
Box.textValue= this.txtName.Text.Trim();
}

}
}


3. The Calling Program

private void button1_Click(object sender, EventArgs e)
{
InputBox.InputBox Box = new InputBox.InputBox();

label1.Text = Box.GetTextValue().ToString();
}

</Code>

Thank you.
 
No change, same problem.
Both the forms show up as blank white space like it is thinking something.

Any other suggestions.

how do I stop the processing until the Input form is clicked?
 
You need ShowDialog or Application.Run in order for a Win32 messagepump to be running in the background, to respond to mouse clicks, paint the screen, etc.

Chip H.


____________________________________________________________________
If you want to get the best response to a question, please read FAQ222-2244 first
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top