StrataFrame Forum

loDialog.ShowDialog(false, false); in C#: error

http://forum.strataframe.net/Topic10945.aspx

By Ralph Rutschmann - 8/20/2007

Hi,



maybe I'm doing something stupid. Following the help files, I tried to include security into my application. This works so far as I don't try to use 'loDialog.ShowDialog(false, false);' which I copied from the help file. That gives me an error message: 'No overload for method 'ShowDialog' takes '2' arguments'. Opposite to that the help file is telling me: 'Showing the SecurityDialog without Permissions or Restriction Sets [C#]'.



I'm using StrataFrame 1.6.1.



Can someone have a look at this?



TIA and friendly greetings,



Ralph
By Trent L. Taylor - 8/20/2007

Ralph,

The SecurityDialog accepts two parms, and the language does not make a difference.  If you open up the Object Browser and look at the SecurityDialog form, do you have a constructor that accepts two boolean parms?  If not, then you may not be running on 1.6.1 and you may need up upgrade to the latest.  Otherwise, please post the stack trace or the error so I know what you are getting.

By Ralph Rutschmann - 8/21/2007

Hello Trent,



thank you very much for your help. StrataFrame support is best! :-)



I did what you wrote and there wasn't any "new" constructor. So I opened the source code and there was all what should be there. Removed the reference and added it again, with no success. I did a clean solution and a rebuild solution, did run the afterbuild.bat, removed the reference to the StrataFrame Security from my own solution, added it again with no success again. I did all of that many times, restarted my machine between, restarted VS between, no success.



The dll is there, opened in VS it looks exactly like your screen shot. But as a reference added to my project, it lacks of the new construtors.



I don't know what's going on or what can I do.



Any hint?



TIA and friendly greetings,



Ralph
By Trent L. Taylor - 8/21/2007

Any hint?

It sounds like you have an older set of SF DLLs that are being built or loaded.  If you download the most recent source code from the website, build it.  Get out of Visual Studio, open your project again, remove the SF references, add the newly recompiled references, clean your solution, get out of VS again, then go back in and recompile do they show up?

I know this sounds like a long way around, but you have some old assemblies somewhere that are being loaded instead of the 1.6.1 assemblies.  Also, one other thing you could try it to manually delete the StrataFrame entries in the GAC before you rebuild the StrataFrame solution.   This way you know they are gone before you build them and then after you build the SF code they should be back in there.  You should only need to remove the four highlighted below....and any versions that are older than 1.6.0.  Just FYI, the GAC will show 1.6.0 for the 1.6.1 version of SF.  We did this intentionally to make it easier for developers to move to the 1.6.1 version.

By Ralph Rutschmann - 8/21/2007

Hello Trent,



I did all you said, but with no success. :-(



Reinstalled StrataFrame, no success.



Something else I can do?



Thank you very much and friendly greetings,



Ralph
By StrataFrame Team - 8/22/2007

Well, the problem is that you're probably using C# and the screenshot that Trent took is from the Object Browser when you have a VB project open.  It changes so that constructors show up as New() instead of [ClassName]() like they do in C#.  I think you're problem is most likely a bug in the help documentation.  Try this snippet and see if it works for you:

using MicroFour.StrataFrame.Security;

...

SecurityDialog dialog = new SecurityDialog(false, false);
dialog.ShowDialog();

I don't think there's an overload for the ShowDialog() method, but there are overloads for the constructor, so you can pass the 2 falses to the dialog's constructor.

By Ralph Rutschmann - 8/23/2007

Hi Ben,

thank you very much for jumping in. Yes, you're right, I'm using C#. Didn't know that makes any difference. I should mention in future that I use C#.

SecurityDialog loDialog = new SecurityDialog(false, false)

That did the trick! :-)

Thank you again and friendly greetings,

Ralph

 

By StrataFrame Team - 8/23/2007

No problem, Ralph Smile

The differences between C# and VB are generally very minor syntax changes, but VS keeps up with them enough to even change the Object Browser!!  Oh well, I think it took me a while before I figured out that when I had a VB project open, lots of stuff changed in the environment.

Glad you got it working.

By Edhy Rijo - 9/4/2008

I've just been bit by this one, the problem is that the topic "Calling the Security Maintenance Dialog" has the code sample wrong like this:

Imports MicroFour.StrataFrame.Security
...
Private Sub ShowSecurityDialog()
    '-- Create the form and show it
    Using loDialog As New SecurityDialog()
        loDialog.ShowDialog(False, False)
    End Using
End Sub

Where the overload parameters should be passed to the New SecurityDialog() like this:

Imports MicroFour.StrataFrame.Security
...
Private Sub ShowSecurityDialog()
    '-- Create the form and show it
    Using loDialog As New SecurityDialog(False, False)
        loDialog.ShowDialog()
    End Using
End Sub
By Dustin Taylor - 9/5/2008

Ah, yep, that would explain the confusion. We'll get it fixed for the 1.6.6 release.

Thanks! BigGrin