E
E
eskims2021-09-06 17:17:24
WPF
eskims, 2021-09-06 17:17:24

How to pass values?

So I have a little problem, because I'm new to c#, I don't quite understand how I can implement this.
On button click, I import log:pass from .txt, and they are stored in variables that are inside ImportClick1, but I don't know how to use this data outside of ImportClick1 (in another form or in another void)

public void ImportClick1(object sender, EventArgs e)
{
/// code
}


Please tell me how to use string log and string pass values ​​outside of ImportClick1

Answer the question

In order to leave comments, you need to log in

1 answer(s)
F
freeExec, 2021-09-06
@eskims

Create variables in the form, not local ones, and write down the login password there.
Like so

private string _login;
public void ImportClick1(object sender, EventArgs e)
{
  _login = GetLoginFromFile();
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question