|
Vikram A Punathambekar wrote: Your solution is so simple, it's beautiful. 5'd.
Thanks.
Vikram A Punathambekar wrote: You'll get your mention in the upcoming article, CPallini.
Thanks again.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
The Random object initialises itself with a value from the System Time so most of the time you're going to get the same value. occasionally the clock will tick over between calls. This seems to be the behaviour you're getting.
If i'm using random I tend to add it as an instance variable or as a public static variable of another class and call getNext() without resetting it.
I found this problem out the hard way and had to ask the good people on CP at the time.
Russ
|
|
|
|
|
Thanks for the reply, Russell. Unfortunately, I have some constraints. Please see my original post (I've updated it). I'd appreciate your assistance.
Cheers,
Vikram.
The cold will freeze our stares
We won't care...
|
|
|
|
|
As there's no chance to alter GetRandomBool(), you might insert a delay:
bool firstPlayersChoice = GetRandomBool();
Thread.Sleep(1);
bool secondPlayersChoice = GetRandomBool();
Any questions about the program being slow can be redirected to the author of GetRandomBool().
____________________________________
There is no proof for this sentence.
|
|
|
|
|
Corinna John wrote: Any questions about the program being slow can be redirected to the author of GetRandomBool().
Since that is yours truly, I changed it as CPallini suggested.
Thanks for your help, though!
Cheers,
Vikram.
The cold will freeze our stares
We won't care...
|
|
|
|
|
I have seen your constraint!
Whoever has written GetRandomBool has written it incorrectly for rapid sequential calls. The random number generator must be reused instead of recreated for each call.
Sorry buddy you really are SOL.
|
|
|
|
|
J4amieC wrote: Whoever has written GetRandomBool has written it incorrectly for rapid sequential calls.
That would be, uh, me. I changed it now - see my reply to CPallini.
Cheers,
Vikram.
The cold will freeze our stares
We won't care...
|
|
|
|
|
If you have the source for the class containing GetRandomBool you could create a static private Random object and call that from GetRandomBool instead. I doubt the overhead of having a random object hanging about is too huge, but you'd need to check.
|
|
|
|
|
hi,
i want to get the total time of the mp3 file. how i get? pls ans me
thank u
senthil
|
|
|
|
|
Hi.
Try to look here: http://www.un4seen.com/
|
|
|
|
|
I have alredy added a DataSet name Publications where I have add three tables.
Table(0) is Query_Volume_VolumeLessons
Table(1) is Query_Volume_Sectos
Table(2) is Query_Volume_Themes
Also put data on Table(0) from SQL SERVER DataBase
Now I need to put data to Table(1) from DataSet Table(0) using a sql query.
Question is?
Do I need any connectionStrings? or should I put the query Insert INTO Table(0) from Table(1) if yes how can I execuite this command in VS code.
Please help me Im suffering a lot
Thanks
Sarfarj Ahmed
|
|
|
|
|
i think if u want to fill table with sql query then it will require connection string,because u can execute query through command object which require connection string.
rahul
|
|
|
|
|
Is their any other way that I can put data from DataSet.Tables(0) to DataSet.Tables.(1)
Sarfarj Ahmed
|
|
|
|
|
Hi,
I need to know who is the splitContainer which contains a determined panel.
Imagine that i create a event that is triggered when i click a panel1 or panel2 of a splitContainer.
How can i know, who is the splitContainer from the Panel click?
Thx,
Nuno
|
|
|
|
|
Try the Parent property.
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook www.troschuetz.de
|
|
|
|
|
Hi,
The SplitterPanel doesnt have a Parent propertie.
|
|
|
|
|
According to MSDN its there (SplitterPanel.Parent Property[^]) and should return what you want. I do not know why it is not intended to be used directly from code, but probably that's why it is not shown to you.
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook www.troschuetz.de
|
|
|
|
|
It does. Intellisense sometimes goes a bit astray, so don't rely on it 100%.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
Yeap, that's right!
Thank you very much!
Nuno
|
|
|
|
|
You're welcome. Glad I could help
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
Hi,
I am using a DataSet with DataTable which will be populated dynamically.
I am not using DataBase.Just a DataTable defined inside a DataSet.
I want to diplay a part of the columns of DataTable in DataGridView.
where should i place the query in datagridview While execution.
With Thanks,
sakthi.
|
|
|
|
|
Set the DataSource of the DataGridView to use the DataTable.
DataTable dataTable = dsDataSet.Tables[0];
dgView.DataSource = dataTable;
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
Hi,
I have added the Datatable as DataSource to the DataGridView.
But i want to add columns at run time.
With Thanks
Sakthi
|
|
|
|
|
I'm a beginner. I want to insert, update a record into a MS Access database. I tryed to do it using using OleDb Managed Provider, but don't seccess. If you have a sample project is written Visual C#.NET 2005, pleased share with me.
Thank you!
|
|
|
|
|
This is oledb and its works for me:
<br />
OleDbConnection con = new OleDbConnection(@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + databaseURL);<br />
Reading:
OleDbDataAdapter resAdapter = new OleDbDataAdapter("SELECT * FROM <table>", con);<br />
OleDbCommandBuilder resCmdBuilder = new OleDbCommandBuilder(resAdapter);<br />
DataSet myDataSet = new DataSet();<br />
resAdapter.Fill(myDataSet, <any name ,need not correspond with <table>);
Inserting
con.Open();<br />
OleDbCommand cmd = con.CreateCommand();<br />
cmd.CommandText = "INSERT INTO <Table> (colname1,colname2....) VALUES(coresponding values)<br />
cmd.ExecuteNonQuery();<br />
con.Close();
Deleting and updating is the same thing , use an UPDATE or DELETE query in CommandText;
CommandText = "UPDATE table_name SET column_name = new_value WHERE column_name = some_value"<br />
CommandText = "DELETE FROM table_name WHERE column_name = some_value";
This should help you with the SQL statements:
http://www.w3schools.com/sql/default.asp[^]
Gideon
|
|
|
|