I try to create office ( outlook ) object and i get crash all the time.
The error code that i get is 80040111 - and i don't know why i getting it because office is install on the machine and and also i setup Office 2003 Interop ( i have office 2003 on this machine ).
The line that i get the crash is
_Application olApp = new ApplicationClass();
before this line i have include office Interop and office core -
I am using tableLayoutPanel on a form with some rows and columns. I put the controls in it at design time but i want to hide last row and it's control initially and the form hight should also be reduced accordingly.
The hidden row should be displayed on one button click and form size should also be expanded accordingly.
I don't want to add the controls at run time everytime, just hide or display the row with all controls at run time. I am unable to get any row specific operation with the tableLayoutPanel.
I wish to have a TextBox which it can fire the list of AutoCompleteCustomSource when the TextBox is clicked without enter any text.
But i can't find any method that can use to trigger AutoComplete list during run time.
hi there, im new to the forums. Im creating a dice game. however my attack logic is some what flawed. I was having trouble with random numbers generating the same number so i placed them inside there own class hoping it would then generate diffrently. however now the same number generates eg 66 + 66. this is a rather pain as my whole game will contain about 7 randoms.All being called ont he same button.Another problem im having (///////second code///////) Where the random only generates and pulls up if (dilemma == 1). Just a note im fairly new to c# so if you could explain any fixes you come up with i'd really appreciate it.
publicstatic Random uc = new Random();
publicstatic Random cc = new Random();
lblwarning.Text = "Warning";
int userresult = Globals4.user + Globals.army;
Globals3.comp = Globals3.cc.Next(1, 100);
Globals4.user = Globals4.uc.Next(1, 100);
Globals4.user = Globals4.user + Globals.army;
MessageBox.Show("Computer rolled " + Globals3.comp + " You rolled " + Globals4.user + " with an army strength of " + Globals.army + " equals " + userresult + "");
Random does not produce actually random values, it's a pseudo-random generator. Seed your Random with time related value. Something like that new Random(DateTime.Now.GetHashCode()); or new Random(Environment.TickCount);
Are you by any chance a graduate of the school of "I'm absolutely not going to read the documentation" programming? The reason I ask is that the title of your original post was the answer, i.e you knew that you wanted to seed the random number generator.
When you were told how to do it, you asked for code. I have just opened the documentation for the Random class and on the introductory page is a full example showing more than one method of seeding the generator.
If you had just done the same then your problem would have been solved in less time than it took to post the question.
well that was a nice response,I presume your from the old school of elitist programmers who bash new people to a language or just say try google Considering i've been looking into this for 3 days hence why i knew what i was doing just not sure how to impliment it and not really understooding the code thats why i posted. I also asked for a interpretation of the code as a general rule to work from not for someone to do it for me. Im sorry ive my lack of knowledge causes you offence but as a rule of thumb forums are to learn from
A lack of knowledge does not offend me in the slightest and I am more than willing to help. The point I made was that you used "Random seeds?" for the title of your post yet you appeared not to have done any research on that very topic.
You must have thought it a bit odd that something called a random number generator was giving the same sequence every time it was used.
Surely the place to start was with the documentation.
As I have understood your post, you are having troubles with random numbers generation.
Here is a solution, that may be helpful.
As it has been noted, a seed number is used to start numbers generation. In most occasions this number is dependent on current time, for example, Environment.TickCount can be such a seed. What happens sometimes, is that number sequences are being generated too fast, so that the time-related seed is not changed. This may result in troubles, when you are generating numbers not in one sequence. Here is a code example. We are generating an array of objects typed sample, and each object contains a set of randomly generated numbers.
double dblMyArray = new double; // number 20 bears no actual meaning, it's just an examplepublic sample()
Random rndObj = new Random(Environment.TickCount);
for (int i = 0; i < dblMyArray.Length; i++)
dblMyArray[i] = rndObj.NextDouble();
staticvoid Main(string args)
sample mainArray = new sample; // number 10 bears no actual meaning, it's just an examplefor (int i = 0; i < mainArray.Length; i++)
mainArray[i] = new sample();
Now, what will happen is a sad fact: all the objects in mainArray will have THE SAME values in dblMyArray. This is because modern computations are fast, and time related seed cannot change fast enough. You may run this code and check out the values.
If you have a similar problem, the solution is to sleep a program for a short time, I used 1ms. This way the seed number will change, and each time you'll have different sequences.
Last Visit: 31-Dec-99 19:00 Last Update: 31-Jan-23 2:52