By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,418 Members | 1,430 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,418 IT Pros & Developers. It's quick & easy.

Parameter question

P: n/a
Hi

I have a class that have a Login Method that opens a Login Form
The client that calls the Login Method should receive the User_ID if logins succed
Is it possible to return from the Login form to the method the UserID and from the method to the client

//THIS IS THE LOGIN METHOD THAT WILL CALL THE LOGIN FOR
public string GUILogin(string sDBUser, string sDBPassw, string sDBDsn

Form oform=new dlgLogin(sDBUser, sDBPassw, sDBDsn, ref ID_Util)
oform.ShowDialog()
// CAN I CATCH HERE THE USERID STORED IN A FORM VARIABLE OR SOMETHING LIKE THAT
Thanks for your help
Bernardo Piano
Nov 15 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
"Bernardo" <bp****@sapo.pt> wrote in message
news:C3**********************************@microsof t.com...
Hi,

I have a class that have a Login Method that opens a Login Form.
The client that calls the Login Method should receive the User_ID if logins succed. Is it possible to return from the Login form to the method the UserID and from the method to the client?
//THIS IS THE LOGIN METHOD THAT WILL CALL THE LOGIN FORM
public string GUILogin(string sDBUser, string sDBPassw, string sDBDsn)
{
Form oform=new dlgLogin(sDBUser, sDBPassw, sDBDsn, ref ID_Util);
oform.ShowDialog();
// CAN I CATCH HERE THE USERID STORED IN A FORM VARIABLE OR SOMETHING LIKE THAT? }

Thanks for your help,
Bernardo Piano


If dlgLogin is your own class, just implement a property containing the user
ID as entered by the user.
So in the dlgLogin form something like,
public string UserID
{
get
{
return (UserIDInputControl).Text;
}
}

Then in the login method, read it like
userID = oform.UserID;

Is that what you're looking for?

Eric

Nov 15 '05 #2

P: n/a
Hi,

You can declare a property in the dlgLogin class that contain the userID ,
you will have to check if the login was not succesful and something about
it.

Cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
"Bernardo" <bp****@sapo.pt> wrote in message
news:C3**********************************@microsof t.com...
Hi,

I have a class that have a Login Method that opens a Login Form.
The client that calls the Login Method should receive the User_ID if logins succed. Is it possible to return from the Login form to the method the UserID and from the method to the client?
//THIS IS THE LOGIN METHOD THAT WILL CALL THE LOGIN FORM
public string GUILogin(string sDBUser, string sDBPassw, string sDBDsn)
{
Form oform=new dlgLogin(sDBUser, sDBPassw, sDBDsn, ref ID_Util);
oform.ShowDialog();
// CAN I CATCH HERE THE USERID STORED IN A FORM VARIABLE OR SOMETHING LIKE THAT? }

Thanks for your help,
Bernardo Piano

Nov 15 '05 #3

P: n/a

Hi, Bernardo!

I have a class that have a Login Method that opens a Login Form.
The client that calls the Login Method should receive the User_ID if logins succed. Is it possible to return from the Login form to the method the UserID and from the method to the client?
//THIS IS THE LOGIN METHOD THAT WILL CALL THE LOGIN FORM
public string GUILogin(string sDBUser, string sDBPassw, string sDBDsn)
{
Form oform=new dlgLogin(sDBUser, sDBPassw, sDBDsn, ref ID_Util);
oform.ShowDialog();
// CAN I CATCH HERE THE USERID STORED IN A FORM VARIABLE OR SOMETHING LIKE THAT? }


Use this sample code:
namespace App.UI
{
public class FormLogin : System.Windows.Forms.Form
{
private System.Windows.Forms.Button button_Accept;
private System.Windows.Forms.Button button_Cancel;
private System.Windows.Forms.TextBox UserID;
private System.Windows.Forms.TextBox Password;

#region Windows Form Designer generated code
...
#endregion

public static DialogResult ShowDialog(out string UserID, out string
Password, IWin32Window owner)
{
DialogResult ret;
FormLogin frm = new FormLogin();
ret = frm.ShowDialog(owner);
UserID = frm.UserID.Text;
Password = frm.Password.Text;
return ret;
}

public static DialogResult ShowDialog(out string UserID, out string
Password)
{
DialogResult ret;
FormLogin frm = new FormLogin();
ret = frm.ShowDialog();
UserID = frm.UserID.Text;
Password = frm.Password.Text;
return ret;
}
}
}
--
Roman S. Golubin
ICQ UIN 63253392
go*****************@arhcity.ru
Nov 15 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.