-
Modules in C#
Good Afternoon All
In VB.NET i used to have a Module. I need to Call the Main Form when the login is successfully. So this is what i deed in C# so Far in a Class, Can someone Help me on this in C#. Becaues C# does not have Modules.
Code:
using System;
using System.Collections.Generic;
using System.Text;
namespace SystemAdmin
{
class Startup
{
public void Main()
{
bool loggedIn;
frmLogin frmlogin = new frmLogin();
loggedIn = (frmlogin.ShowDialog() == DialogResult.OK);
if (loggedIn)
{
Application.Run(new frmmain());
}
}
}
}
And my Login Screen Login button is like this
Code:
String strusername = txtusername.Text;
String Password = txtpassword.Text;
int bl ;
bl = obj.Check_Login(strusername, strPassword);
if (bl == 1)
{
Me.DialogResult = Windows.Forms.DialogResult.OK;
}
else
{
MessageBox.Show("Invalid Login");
}
Thanks
-
Re: Modules in C#
Well Modules in VB have their downsides...
People prefer declaring all their public variables inside a module, but that doesn't make your program 100% object oriented - I guess it's just my opinion...
One option may be to make sealed classes with private constructors ( where all the members are static )
-
Re: Modules in C#
Your post looks like reasonable C#....
What is the PROBLEM?????
-
1 Attachment(s)
Re: Modules in C#
OK
My Problem is shown on ScreenShot
-
Re: Modules in C#
1) you do not have a class named "frmLogin" in the current namespace, nor do you have a "using" statement to import the namespace.
2) You do not have the proper namespace for Dialog Result.
A simple "right-click" and "Resolve..." will address the issues, if the proper assemblies are referenced in your project.
-
Re: Modules in C#
Thank you Very much, its Resolved