|
Hi,
well you could iterate through the listbox-items and concat their text-properties. Just something like this:
StringBuilder oBuilder = new StringBuilder();
foreach(object oCurItem in myListbox.Items) {
oBuilder.Append(oCurItem.ToString());
}
string sResult = oBuilder.ToString();
Let me know if this helps you.
Regards
Sebastian
|
|
|
|
|
StringBuilder sb = new StringBuilder();
foreach (string s in listBox1.Items)
sb.Append(s);
|
|
|
|
|
string s = "";
for (int i = 0; i < lstSelected.Items.Count; i++)
{
if (s != "")
{
s = s + "," + lstSelected.Items[i].ToString();
}
else
{
s = lstSelected.Items[i].ToString();
}
}
But S-->is getting "System.Data.DataRowView" value instead of listbox item.
|
|
|
|
|
Try to use
<br />
<br />
((System.Data.DataRowView) lstSelectedItems.Items[i]).Item[0].ToString()<br />
<br />
instead.
|
|
|
|
|
StringBuilder s = new StringBuilder();
for (int i = 0; i < lstSelected.Items.Count; i++)
{
s.Append(lstSelected.Items[i].Text);
}
I Love T-SQL
"Don't torture yourself,let the life to do it for you."
If my post helps you kindly save my time by voting my post.
|
|
|
|
|
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 ?
|
|
|
|