Hello all! Looking for some help with this, I've been using a book to make an sql database to store names, and was hoping to use a button to randomly select any of the names in the database to be allocated to one of two machines. Also there is a checkbox, which if checked would mean that particular person will not be selected. Here is a picture of the GUI:

http://farm3.static.flickr.com/2689/4087620111_e9b76fa9c7_o.jpg

As for the code so far:

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 IttellaII
{

    public partial class Form1 : Form
    {
        private readonly string[] NAMES = new string[]
{



};

        public Form1()
        {
            InitializeComponent();
        }

        private void pictureBox1_Click(object sender, EventArgs e)
        {
            MessageBox.Show("Machine List 1.0.0.\nWritten by: Nathan Sharpe","About");
        }

        private void machineWorkersBindingNavigatorSaveItem_Click(object sender, EventArgs e)
        {
            this.Validate();
            this.machineWorkersBindingSource.EndEdit();
            this.tableAdapterManager.UpdateAll(this.machineListDBDataSet);

        }

        private void machineWorkersBindingNavigatorSaveItem_Click_1(object sender, EventArgs e)
        {
            this.Validate();
            this.machineWorkersBindingSource.EndEdit();
            this.tableAdapterManager.UpdateAll(this.machineListDBDataSet);

        }

        private void Form1_Load(object sender, EventArgs e)
        {
            // TODO: This line of code loads data into the 'machineListDBDataSet.MachineWorkers' table. You can move, or remove it, as needed.
            this.machineWorkersTableAdapter.Fill(this.machineListDBDataSet.MachineWorkers);

        }


        private void btGenerateWorkers_Click_1(object sender, EventArgs e)
        {
            //MachineListDBDataSet.ToString;
            //Random.ReferenceEquals.OnClick Generate

        }
        


       
        } 
    }

As you can see not much has happened since the GUI and database have been created... I am very lost at how to start the rest...

Thanks in advance to anyone who can help!

Cheers nathan

Not sure what you are looking for. Are you wanting to load a table from your database containing the names and their availability (all of info already in table) and then randomly select two names from the table data having records marked/flagged as available?

If you want to select a random row from MS-SQL database then use,

SELECT TOP 1 column FROM table ORDER BY NEWID()

Not sure what you are looking for. Are you wanting to load a table from your database containing the names and their availability (all of info already in table) and then randomly select two names from the table data having records marked/flagged as available?

Thanks, yeah I have two combo boxes and providing the people are checked, click the button and into the combo boxes 'randomly' will appear some names of those who are working...

Guess the check box is a simple 'if' statement, but I dont know the code for the button/combo boxes and how to generate random names for them...

Aaarrgggh! =)

This article has been dead for over six months. Start a new discussion instead.