Hallo, ich bin gerade dabei ein kleinen Bot zu schreiben.. Dabei habe ich eine Form 1 wo mein Browser ( also das Spiel ) drauf läuft. Nun habe ich einen Button, der eine 2 Form öffnet wo man seine Logindaten eingeben kann. Diese daten sollen in string´s gespeichert werden und dann an die Form 3 ( die sich nachdem man Save auf der Form2 gedrückt hat ) gesendet werden und dort dann wieder ausgegeben werden. Doch leider bekomme ich das einfach nicht hin. In google stehen viele verschiedene sachen, die mir aber alle nicht geholfen haben. Daher habe ich mich dazu entschieden hier mal nach zufragen.
/*
There should be 2 textboxes.
usernameTXT is for the username
passwordTXT is for the password
*/
//Declaration;
private Form3 _Form3 = null;
//Form Load Event;
_Form3 = new Form3();
//Form Close Event;
_Form3.userName = usernameTXT.Text;
_Form3.password = passwordTXT.Text;
_Form3.Dispose(); _Form3 = null;
You can then use them on Form3 using userName & password
public partial class Form1 : Form
{
public Form1()
{
this.InitializeComponent();
}
private void OnButtonOpenForm2Click(object sender, EventArgs e)
{
var form2 = new Form2();
form2.ShowDialog(this);
}
}
Form2 (Login):
Code:
public partial class Form2 : Form
{
public Form2()
{
this.InitializeComponent();
}
private void OnButtonSaveClick(object sender, EventArgs e)
{
var loginParameter = new LoginParameter
{
Username = "John Doe", // Or Username = this.TextBoxUsername.Text
Password = "12345" // Or Password = this.TextBoxPassword.Text
};
var form3 = new Form3(loginParameter); // Pass login parameters to form3 via constructor.
form3.ShowDialog(this);
}
}
Form3 (Output):
Code:
public partial class Form3 : Form
{
private readonly LoginParameter _loginParameter;
public Form3(LoginParameter loginParameter)
{
this.InitializeComponent();
this._loginParameter = loginParameter;
}
private void ShowLoginParameter()
{
string text = String.Format("User: {0} | Password: {1}",
this._loginParameter.Username, this._loginParameter.Password);
MessageBox.Show(text, "Login Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
}
LoginParameter.cs (Extra class for login information)
Code:
public class LoginParameter
{
public string Username { get; set; }
public string Password { get; set; }
}
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
Form3 frm3 = new Form3();
frm3.Show();
}
}
}
Form2:
Code:
namespace WindowsFormsApplication1
{
public partial class Form2 : Form
{
public Form2()
{
InitializeComponent();
}
public delegate void LoginEventHandler(object sender, LoginEventArgs e);
public event LoginEventHandler LoggedIn;
private void button1_Click_1(object sender, EventArgs e)
{
LoggedIn(this, new LoginEventArgs(textBox1.Text, textBox2.Text));
}
}
public class LoginEventArgs
{
private string _username;
public string username { get { return _username; } }
private string _password;
public string password { get { return _password; } }
public LoginEventArgs(string Username, string password)
{
this._username = Username;
this._password = password;
}
}
}
Form3:
Code:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace WindowsFormsApplication1
{
public partial class Form3 : Form
{
public Form3()
{
InitializeComponent();
}
private void Form3_Load(object sender, EventArgs e)
{
Form2 frm2 = new Form2();
frm2.Show();
frm2.LoggedIn += received;
}
private void received(object sender,LoginEventArgs e)
{
MessageBox.Show(e.username);
MessageBox.Show(e.password);
}
}
}
Druid Cat Form -> FireLands Cat Form 08/01/2011 - World of Warcraft - 2 Replies Hallo Leute,
hat jemand die Möglichkeiten mir eine Tauren Katze zur Firelands Katze zu swappen - sofern dies in 4.2 FIRELANDS noch möglich ist.
Wobei die Vergangenheit uns gelehrt hat, das es immer Mittel und Wege gibt. (:
http://manaflask.com/images/galleries/scaled_1307 971939_flamecat.jpg
LG
Windkirsche
Von Form Zu Form Wechseln. 04/14/2011 - AutoIt - 2 Replies Hallo Erstmal!
Ich wollte mal etwas machen das von einer form zur anderen wechselt jetzt wollt ich das aber auch so machen das wenn man auf einen zurück button klickt es wieder zur ersten form kommt und dann alles neu einstellen kann. also bis zu dem zurück und neu einstellen hab ich geschafft aber wenn man dann wieder auf weiter klickt passiert nix ... Könntet ihr mir helfen? Hier ist ein beispiel script
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include...
Form unsichtbar machen und Variable senden 09/18/2010 - AutoIt - 4 Replies Hallo,
ich habe zwei kleine Probleme und bin durch Google nicht fündig geworden. Wie kann man bei einer Form visible setzen und wie kann ich eine Variable mit Send() senden?
Danke schonmal im vorraus :D
FizzeBu
Druid Tree form buff without tree Form 11/11/2007 - WoW Exploits, Hacks, Tools & Macros - 5 Replies My buddy and i were screwing around the other day in Mech and we figured out a way to have a working tree form buff for the party but not be in tree form. Which if anyone knows about druids allows them to cast all their other high healing spells. Anyway follow the instructions below its a bit tricky
1. Change your chest item to something else
2. Get into Combat.. Queue your chestpiece to switch back to your original
3. When the fights finishing, Get ready.. The second the...