Well, first off you don't show a dialog by going 'New DialogClassName.ShowDialog()' that's a syntax error, since DialogClassName.ShowDialog() is a method, not a type (since you
could have a sub-class on DialogClassName called ShowDialog, as wacky as that sounds).
Main is your... main window from the looks of it, it's not a dialog so it won't be returning a Dialog Result. Using just Main.Show() would suffice.
I think what you want is to specify a new Constructor on Main which has a single String Parameter named 'userName':
[font=courier new][color=#0000FF]public[/color] [color=#0000FF]void[/color] [color=#008080]Main[/color][color=#808080]([/color][color=#0000FF]string[/color] [color=#008080]userName[/color][color=#808080])[/color]
[color=#808080]{[/color]
[color=#008000]//Do stuff here, like loading.
[/color] [color=#0000FF]this[/color][color=#808080].[/color][color=#008080]InitializeComponent[/color][color=#808080]([/color][color=#808080])[/color][color=#808080];[/color] [color=#008000]//Use the windows forms designer's auto-generated method 'InitializeComponent'
[/color] [color=#808080]}[/color][/font]
Note the best place to put this, for your future sanity, is not inside Login, but rather the place that creates the login dialog. Using the method before of setting a dialog result property on your buttons, allows it to automatically know what kind of result the dialog yields, ie. Login/OK or Cancel. Only set the local values of Login when the button with a Dialog result of DialogResult.OK is clicked. This ensures that when you use the data from Login, it gives you something you can use.
Here's an example usage:
[font=courier new][color=#008080]Login[/color] [color=#008080]loginInstance[/color] [color=#808000]=[/color] [color=#0000FF]new[/color] [color=#008080]Login[/color][color=#808080]([/color][color=#808080])[/color][color=#808080];[/color]
[color=#008080]var[/color] [color=#008080]dialogResult[/color] [color=#808000]=[/color] [color=#008080]loginInstance[/color][color=#808080].[/color][color=#008080]ShowDialog[/color][color=#808080]([/color][color=#808080])[/color][color=#808080];[/color]
[color=#0000FF]if[/color] [color=#808080]([/color][color=#008080]dialogResult[/color] [color=#808000]==[/color] [color=#008080]DialogResult[/color][color=#808080].[/color][color=#008080]OK[/color][color=#808080])[/color]
[color=#808080]{[/color]
[color=#008080]Main[/color] [color=#008080]mainDialog[/color] [color=#808000]=[/color] [color=#0000FF]new[/color] [color=#008080]Main[/color][color=#808080]([/color][color=#008080]loginInstance[/color][color=#808080].[/color][color=#008080]userName[/color][color=#808080])[/color][color=#808080];[/color]
[color=#008080]Application[/color][color=#808080].[/color][color=#008080]Run[/color][color=#808080]([/color][color=#008080]mainDialog[/color][color=#808080])[/color][color=#808080];[/color]
[color=#808080]}[/color][/font]
More than likely the code above would be used within your 'Main' method. Which is why I'd recommend calling your 'Main' form 'MainWindow' so it's clear that you mean the Main Window versus the entry point of the application. Same applies to Login, I'd recommend refactoring it to 'LoginDialog', if you don't know what Refactoring is, go to the point where you declared Login, and press 'F2', it should bring up a window that asks you for the new name, alternatively you could click Refactor, Rename.
If you have further questions, let me know.
Edit: also, within the point where you say 'if (dialogResult == DialogResult.OK)' you might want to use: 'if (dialogResult == DialogResult.OK && loginInstance.VerifyLogin())' instead.
Edit (2): And in order to make it work, when you're storing the 'userName' local on LoginDialog, you'll also have to store the password or other credential information the user entered into a local so the VerifyLogin will be able to do its work, once the Form is hidden from view (any button with DialogResult auto-hides the dialog, if I remember correctly), the Form disposes the controls, so the text boxes and so forth won't (or at least shouldn't) have the data any more.