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