Code Newbie
News     Forums     Search     Members     Sign Up    

My Code Newbie
Username

Password

Articles/Snippets
ASP Classic
ASP.NET
C
C#
C++
HTML / CSS
Java
Javascript
Linux / BSD
Perl
PHP
Python
Ruby
SQL
VB 6
VB.NET

C.N. Friends
  Planet Rome

Link to Us!
Code Newbie
  Code Newbie
    forums
Old 10-11-2004, 11:10 PM   #1 (permalink)
sureshkumar_kc
Registered User
 
sureshkumar_kc's Avatar
 
Join Date: Sep 2004
Posts: 12
sureshkumar_kc is on a distinguished road
listbox

Hello

In C#
I am filling the items to the listbox dynamically

listBox1.Items.Insert(0,"Time");
listBox1.Items.Insert(1,"Spectra"); listBox1.Refresh();

but this items not visible in the listbox at run time.

should I need to set any property ?
sureshkumar_kc is offline   Reply With Quote
Old 10-12-2004, 06:12 AM   #2 (permalink)
sde
Moderator
 
sde's Avatar
 
Join Date: May 2002
Location: us.ca
Posts: 4,444
sde is on a distinguished road
try using Add instead of insert:
Code:
listBox1.Items.Add("abc");
listBox1.Items.Add("def");
__________________
Mike
sde is offline   Reply With Quote
Old 10-13-2004, 05:34 AM   #3 (permalink)
sde
Moderator
 
sde's Avatar
 
Join Date: May 2002
Location: us.ca
Posts: 4,444
sde is on a distinguished road
did this work?
__________________
Mike
sde is offline   Reply With Quote
Old 10-13-2004, 10:11 PM   #4 (permalink)
sureshkumar_kc
Registered User
 
sureshkumar_kc's Avatar
 
Join Date: Sep 2004
Posts: 12
sureshkumar_kc is on a distinguished road
How to convert string to Color datatype here..

Color nn=new Color();
string ss;
ss="Red";

In this step--->> nn=(Color)ss.ToString();
sureshkumar_kc is offline   Reply With Quote
Old 10-13-2004, 10:43 PM   #5 (permalink)
sde
Moderator
 
sde's Avatar
 
Join Date: May 2002
Location: us.ca
Posts: 4,444
sde is on a distinguished road
hmm .. you're probably better off over here --> http://dotnetforums.net/
__________________
Mike
sde is offline   Reply With Quote
Old 10-15-2004, 01:41 AM   #6 (permalink)
RobertStout
Registered User
 
RobertStout's Avatar
 
Join Date: Oct 2004
Location: Dank cellar
Posts: 18
RobertStout is on a distinguished road
:rock:

Code:
Color myColor = Color.Red;
myListBox.ForeColor = myColor;
myListBox.Items.Add("Red Text");
Strings don't have a color property, instead set the forecolor property on the listbox itself.
RobertStout is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -8. The time now is 02:15 PM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.0.0 RC8





Copyright © 2000-2008, Milano Interactive
Web Hosting provided by Portal 360 Web Hosting