PDA

View Full Version : UserForm Hide/Show Problem



bweir
2006-11-28, 04:13 PM
Working with Acad07 & VS05. I have a user form that is displayed using something like myForm.ShowDialog(). On this form is a button that allows the user to select coordinates. The form hides using myForm.Hide() and I've tried a number of ways to bring it back but can't seem to.

I also tried myForm.Visible = False (rather then Me.Hide()) but this didn't help when trying to bring the form back either. What am I missing?

Here's the code for the button.


Dim oRes As Autodesk.AutoCAD.EditorInput.PromptPointResult

Me.Hide()

oRes = oEd.GetPoint(vbNewLine & "Select the top right corner: ")
If oRes.Status = Autodesk.AutoCAD.EditorInput.PromptStatus.OK Then
Me.oTxt_MaxX.Text = oRes.Value.X
Me.oTxt_MaxY.Text = oRes.Value.Y
CheckMinMax()
End If

Me.Visible = True

Opie
2006-11-28, 05:28 PM
I don't use (or know) dot net, but is there a .Show() function?

bweir
2006-11-28, 10:31 PM
Yep, that also fails.

Opie
2006-11-28, 11:34 PM
Yep, that also fails.
Wish I could help more. :(

Good Luck

dmarcotte4
2006-11-29, 02:30 AM
You shouldn¡¯t have to call hide. AutoCAD will hide your form for you
For example: (sorry it¡¯s in C#)

This code hides my form and gets a double, Automagicly without calling hide





// a snippet form my form
private void buttonPickWidth_Click(object sender, EventArgs e)
{
GetDist();
}




public static Double GetDist()
{
Editor editor1 = acadApp.DocumentManager.MdiActiveDocument.Editor;
PromptDistanceOptions options1 = new PromptDistanceOptions("\nSpecify first point:");
options1.Message = "\nSpecify first point:";
PromptDoubleResult result1 = null;
result1 = editor1.GetDistance(options1);
double myValue;
if (result1.Status == PromptStatus.OK)
{
myValue = result1.Value;

}
else
{
myValue = 0.0;
}

return myValue;
}

bweir
2006-11-29, 03:14 PM
You shouldn¡¯t have to call hide. AutoCAD will hide your form for you
For example: (sorry it¡¯s in C#)


Thanks, no problem for the C# I also do little in it. I was not aware that AutoCAD will hide the form. I'll have to try it and see.

bweir
2006-12-06, 04:00 PM
Found something I was doing wrong...

I should have probably used the
Autodesk.AutoCAD.ApplicationServices.Application.ShowModalDialog(myForm)
- or -
Autodesk.AutoCAD.ApplicationServices.Application.ShowModelessDialog(myForm)
rather then the form's show method. But I'm still having some difficulty with the form coming back after the point has been selected.