|
using System;
using System.Collections.Generic;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace MBeatini
{
public partial class FormAddUser : Form
{
public FormAddUser()
{
InitializeComponent();
// fill the combobox
UserManager um = new UserManager();
ArrayList al = um.ListGroupsInServer();
al.Sort();
for (int i = 0; i < al.Count; i++)
comboBox1.Items.Add(al[i]);
um = null;
}
private void button2_Click(object sender, EventArgs e)
{
Close();
}
private void button1_Click(object sender, EventArgs e)
{
if (textBox1.Text.Trim().Length == 0)
{
MessageBox.Show("Username: mandatory field!", "Warning", MessageBoxButtons.OK);
textBox1.Focus();
}
else if (textBox2.Text.Trim().Length == 0)
{
MessageBox.Show("Password: mandatory field!", "Warning", MessageBoxButtons.OK);
textBox1.Focus();
}
else
{
UserManager um = new UserManager();
if (!um.AddUser(textBox1.Text, textBox2.Text, textBox3.Text, comboBox1.SelectedItem.ToString()))
MessageBox.Show(um.ErrorMessage, "Warning", MessageBoxButtons.OK);
else
MessageBox.Show("User " + textBox1.Text + " created", "Warning", MessageBoxButtons.OK);
um = null;
}
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.