Two things.
1. In this code:
public UserControlStart(string test)
{
this.textBoxUsername.Text = xc;
}
you pass in a string
test
but never use it, so why pass it? If your code is full of redundant code, it makes it much harder to debug.
2. You have:
public string xc, yc;
they should be
private
NOT public
. I suspect that you changed the access level at some time whilst trying to get this to work but it is a very, very bad idea to have public members. Use public properties instead, if you want access from outside your class.
If I have correctly interpreted what you are trying to do you want the user to Login and then display another Form for your application and I think that this is what you are trying to do with this code:
this.Controls.Clear();
Start.ActiveForm.Size = new System.Drawing.Size(500, 560);
this.Controls.Add(new UserControlForm());
What is
Start
as in
<big>Start</big>.ActiveForm.Size
? What is
UserControlForm
, and why on earth are you trying to insert it into the
Controls
collection of your
UserControlStart
?
You have references to these in your code without explaining what they are and what they are supposed to do and still expect people to be able to diagnose your problem and help you.
From what I am able to discern from your code you are approaching this in entirely the wrong way. The normal way would be to have a Login Form/Dialog, show that and get the users credentials, close it and then open the main Form for the application. The Login Dialog and the Main Form should be entirely separate not entangled as you seem to be doing. The Login Dialog should handle everything to do with authenticating the user, and the username and password should be discarded as soon as they are verified. They should NEVER, EVER be passed around in your application (particularly the password) as this leaves the system wide open to hacking.