登录后在文本框中检索用户 [英] retrieve user in textbox after login

查看:72
本文介绍了登录后在文本框中检索用户的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好

我有动态登录的登录表单

Hello

I have login form with dynamic login

private void button1_Click(object sender, EventArgs e)
        {
            dynamic login = this.usersTableAdapter1.userpasswordString(txtKorisnik.Text, txtLozinka.Text);
            if (login == null)
            {
                MessageBox.Show("Login fail!");
            }
            else
            {
                start str = new start();
                str.Show();
                this.Hide();



其中userpasswordString是从数据集中查询的,它可以正常工作,但是我希望能够在以代码形式看到的称为start的主要形式成功登录后,在文本框中看到已登录用户的名称,只是不知道该怎么做? ?????

帮助?



where userpasswordString is query from dataset and it works fine, but I want to be able that upon succesfull login in main form called start as it seen in code to see the name of logged in user in textbox, just dont know how to do it??????

Help?

推荐答案

在开始"表单中使用标签框.当用户成功登录时,启用它并在标签框中显示用户名.

///开始表格
in the Start form use a label box.When user succesfully logs in enable it and show the user name in the label box.

///START FORM
label1.enabled=true;
label1.text=txtKorsinik.text;




希望这对您有帮助.




hope this helps you.


您可以以修改形式为公开形式的strat形式添加文本框...

这样的代码就可以了.

You can add the textbox in strat form whose modifir is public...

so the code can be..

Start str = new Start();
     str.txt_usr.Text = usr.Text;
     str.Show(); 



我想这可能会对您有所帮助.



I think this might help you.


shonezi,

在开始表单中,您可以通过添加新参数来编辑其构造函数,如下所示:

Hi shonezi,

In the start form you can edit its constructor by adding a new parameter like this :

public start (string User_Name)
{
    InitializeComponent();

    textBox1.Text = User_Name;   // where textBox1 is the textbox you want to fill with the UserName
}



在您的登录代码中,您可以按以下方式调用start:



and in your login code you can call start as follows :

start str = new start(textBox1.text);  // where textBox1 is the textBox where the username is entered
str.Show();



在这里,您可以从启动表单类中任何位置的启动表单访问用户名.

希望对您有帮助,
:)



Here your you can access the username from start form from anywhere in the start form class.

I hope this helps you,
:)


这篇关于登录后在文本框中检索用户的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆