|
foreach (DataRowView item in listBox.Items)
{
txtBox.Text += item.Row["RowNameYouWant"].ToString() + "\n";
}
|
|
|
|
|
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...
|
|
|
|
|
|
Hello Givya,
Have you tried searching[^]?
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
Hi
Use Random class like
Random r = new Random();
givya wrote: in my application i need to provide a default password if the user forgets the password
IMO ,If possible try to provide forgot password functionality like [Hint Question or Alternate Email]...
himanshu
|
|
|
|
|
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();
char ch;
for (int i = 0; i < size; i++)
{
ch = Convert.ToChar(Convert.ToInt32(Math.Floor(26 * random.NextDouble() + 65)));
builder.Append(ch);
}
if (lowerCase)
return builder.ToString().ToLower();
return builder.ToString();
}
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;"
Pls help
|
|
|
|
|
Hi.
i get system date in this format "mm/dd/yyyy" like "07/15/2009" now i want to change date format like this "15-JUL-2009"
how can i do??
thanks in Advance
jawad khatri
|
|
|
|
|
|
Try this
DateTime dt = DateTime.Now;
MessageBox.Show(dt.ToString("dd/MMM/yyyy"));
<pre>
<div class="ForumSig">Regards,
Karthik K...</div>
|
|
|
|
|
|
see this use this namespace
System.Globalization;
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
Label1.Text = DTFI.LongDatePattern;
Label1.Text = DTFI.ShortDatePattern;
|
|
|
|
|
please help me
I want fill color between two curves in the zedgraph control.please help me.
|
|
|
|
|
I want to save jpg image 100 X 150 size in color format of 256color to reduce its size ..........
suggest me any c# function
|
|
|
|
|
|
btw, there's no such thing as a 256 color jpeg
|
|
|
|
|
this can help you
Image img=new Bitmap("filepath.jpg");
Bitmap bmp=null;
for(int i=0;i<img.Width;i++)
{
for(int j=0;j<img.Height;j++)
{
Color col=img.GetPixel(i,j);
int avg=((col.R+col.G+col.B)/3);
img.SetPixel(i,j,Color.FromArgb(avg,avg,avg));
}
}
MemoryStream mem=new MemoryStream();
img.Save(mem,ImageFormat.Gif);
bmp=new Bitmap(mem);
this.pictureBox1.Image=bmp;
Abdul Rahaman Hamidy
Database Developer
Kabul, Afghanistan
|
|
|
|
|
Very nice, but that still doesn't make a 256 colour jpg (from what I can tell, it'd make a greyscale gif), which isn't what the OP wanted
|
|
|
|
|
i know i only mentioned, that can help
Abdul Rahaman Hamidy
Database Developer
Kabul, Afghanistan
|
|
|
|
|
|
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 ?
|
|
|
|
|
Hi,
sorry for asking you, but what is a COM-leak? How does you know it is one? (Exception, error etc.?)
Regards
Sebastian
|
|
|
|
|
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.
|
|
|
|
|
It is possible to "hook" into the event if Alt-F4 is called. Do you got a Forms-application? If yes you can register an event handler for FormClosing. Within this handler you can call the close-method for your COM.
|
|
|
|
|
If have tried Form_Closed and/or Form_Closing event to call Marshal.ReleaseCOMObject(). But it doesn't help,
|
|
|
|
|
Hmmmm... Other way could be to go into the Dispose()-method of the form and to call the release-method there.
|
|
|
|