i wanna know how to create random numbers in c#. in my application i need to provide a default password if the user forgets the password. i wanna give this default password in the form of random numbers. pls help...
I gave the following code to generate the random string(searched it on internet).
private string RandomString(int size, bool lowerCase)
StringBuilder builder = new StringBuilder();
Random random = new Random();
for (int i = 0; i < size; i++)
ch = Convert.ToChar(Convert.ToInt32(Math.Floor(26 * random.NextDouble() + 65)));
Bt its giving the following error:
A using namespace directive can only be applied to namespaces; 'System.Text.StringBuilder' is a type not a namespace
I hav used this also: "using System.Text.StringBuilder;"
see this use this namespace
DateTimeFormatInfo DTFI = new CultureInfo("hi-IN", false).DateTimeFormat;
//here 'hi-EN' represent the Hindi-INDIA Indian culture here georgian
//calender formate ie dd/MM/yy
DTFI.DateSeparator = ":";
Label1.Text = DTFI.Calendar.ToString();
//we will ge the calender in formation
Label1.Text = DTFI.FullDateTimePattern.ToString();
//give the Date/time/year formate of that culture
I have a simple C#-(Windows-)Application. The Main-Form has two COM-Members. Working with this variables is ok, everything works as expected. When i close the application by the menu, i call Close() in the event-handler and everything is ok, but when i close by systemmenu or alt-f4 i got a com-leak. What is the reason, what is missing ?
At the end of the programm, INSIDE the COM-Component it is checked wether all references are "freed", this means if the refcounts are down to zero. The component is not only one single object, instead the library contains an object-hierarchy.
Last Visit: 31-Dec-99 19:00 Last Update: 6-Dec-23 8:47