C# Random names

Please support our C# advertiser: Intel Parallel Studio Home
Reply

Join Date: Nov 2009
Posts: 2
Reputation: Natsu29 is an unknown quantity at this point 
Solved Threads: 0
Natsu29 Natsu29 is offline Offline
Newbie Poster

C# Random names

 
0
  #1
29 Days Ago
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/...b76fa9c7_o.jpg

As for the code so far:

  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Windows.Forms;
  9.  
  10.  
  11. namespace IttellaII
  12. {
  13.  
  14. public partial class Form1 : Form
  15. {
  16. private readonly string[] NAMES = new string[]
  17. {
  18.  
  19.  
  20.  
  21. };
  22.  
  23. public Form1()
  24. {
  25. InitializeComponent();
  26. }
  27.  
  28. private void pictureBox1_Click(object sender, EventArgs e)
  29. {
  30. MessageBox.Show("Machine List 1.0.0.\nWritten by: Nathan Sharpe","About");
  31. }
  32.  
  33. private void machineWorkersBindingNavigatorSaveItem_Click(object sender, EventArgs e)
  34. {
  35. this.Validate();
  36. this.machineWorkersBindingSource.EndEdit();
  37. this.tableAdapterManager.UpdateAll(this.machineListDBDataSet);
  38.  
  39. }
  40.  
  41. private void machineWorkersBindingNavigatorSaveItem_Click_1(object sender, EventArgs e)
  42. {
  43. this.Validate();
  44. this.machineWorkersBindingSource.EndEdit();
  45. this.tableAdapterManager.UpdateAll(this.machineListDBDataSet);
  46.  
  47. }
  48.  
  49. private void Form1_Load(object sender, EventArgs e)
  50. {
  51. // TODO: This line of code loads data into the 'machineListDBDataSet.MachineWorkers' table. You can move, or remove it, as needed.
  52. this.machineWorkersTableAdapter.Fill(this.machineListDBDataSet.MachineWorkers);
  53.  
  54. }
  55.  
  56.  
  57. private void btGenerateWorkers_Click_1(object sender, EventArgs e)
  58. {
  59. //MachineListDBDataSet.ToString;
  60. //Random.ReferenceEquals.OnClick Generate
  61.  
  62. }
  63.  
  64.  
  65.  
  66.  
  67. }
  68. }

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
Reply With Quote Quick reply to this message  
Join Date: Jul 2009
Posts: 927
Reputation: DdoubleD is a jewel in the rough DdoubleD is a jewel in the rough DdoubleD is a jewel in the rough DdoubleD is a jewel in the rough 
Solved Threads: 150
DdoubleD DdoubleD is offline Offline
Posting Shark
 
0
  #2
29 Days Ago
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?
Reply With Quote Quick reply to this message  
Join Date: Oct 2008
Posts: 2,668
Reputation: adatapost has much to be proud of adatapost has much to be proud of adatapost has much to be proud of adatapost has much to be proud of adatapost has much to be proud of adatapost has much to be proud of adatapost has much to be proud of adatapost has much to be proud of adatapost has much to be proud of adatapost has much to be proud of 
Solved Threads: 476
Moderator
adatapost's Avatar
adatapost adatapost is offline Offline
Posting Maven
 
0
  #3
29 Days Ago
If you want to select a random row from MS-SQL database then use,
  1. SELECT TOP 1 column FROM table ORDER BY NEWID()
Reply With Quote Quick reply to this message  
Join Date: Nov 2009
Posts: 2
Reputation: Natsu29 is an unknown quantity at this point 
Solved Threads: 0
Natsu29 Natsu29 is offline Offline
Newbie Poster
 
0
  #4
28 Days Ago
Originally Posted by DdoubleD View Post
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! =)
Reply With Quote Quick reply to this message  
Reply

Message:



Similar Threads
Other Threads in the C# Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC