Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Sep 11th, 2006, 1:18 PM   #11
Anonymous Coward
Newbie
 
Join Date: Sep 2006
Posts: 11
Rep Power: 0 Anonymous Coward is on a distinguished road
I dont mean to be rude but I would reccomend looking at the MSDN Docs or the .net Framework SDK.

If you look up System.Windows.Forms namespace in the .net Class reference section you should find the ComboBox class with all the methods and properties all documented in great detail. There are also lots of examples given in the .net SDK docs.

If all that fails and you have no idea then try google. Its all too easy to just ask in a forum. I have been reading this forum for about a year and I think if people read documentation and utlised google more there would be less need to post simple questions. You might take offence at what I have just said. I did not intend any and am only trying to help you become a better programmer.
Anonymous Coward is offline   Reply With Quote
Old Sep 11th, 2006, 1:23 PM   #12
crawforddavid2006
Expert Programmer
 
crawforddavid2006's Avatar
 
Join Date: Apr 2005
Location: Not sure yet
Posts: 582
Rep Power: 0 crawforddavid2006 is an unknown quantity at this point
Send a message via AIM to crawforddavid2006 Send a message via MSN to crawforddavid2006
I tried google and maybe i wasnt searching for the right stuff but i could not find anything useful. I will try the MSDN Docs (i forgot about those). And no you were not rude
__________________
Quote:
Originally Posted by DaWei View Post
Well, it's better than Pen Islands url....;)

crawforddavid2006 is offline   Reply With Quote
Old Sep 11th, 2006, 5:03 PM   #13
crawforddavid2006
Expert Programmer
 
crawforddavid2006's Avatar
 
Join Date: Apr 2005
Location: Not sure yet
Posts: 582
Rep Power: 0 crawforddavid2006 is an unknown quantity at this point
Send a message via AIM to crawforddavid2006 Send a message via MSN to crawforddavid2006
I can't seem to find anything in the MSDN Docs. Would someone be able to help me?
__________________
Quote:
Originally Posted by DaWei View Post
Well, it's better than Pen Islands url....;)

crawforddavid2006 is offline   Reply With Quote
Old Sep 11th, 2006, 5:03 PM   #14
Ooble
I eat cake for breakfast.
 
Ooble's Avatar
 
Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 9 Ooble is on a distinguished road
Comboboxes take single lines. If you want to add each line as a new entry into the combobox, do just that: split the text up (myString.Split('\n')) and add 'em all separately.
__________________
Me :: You :: Them
Ooble is offline   Reply With Quote
Old Sep 11th, 2006, 10:46 PM   #15
crawforddavid2006
Expert Programmer
 
crawforddavid2006's Avatar
 
Join Date: Apr 2005
Location: Not sure yet
Posts: 582
Rep Power: 0 crawforddavid2006 is an unknown quantity at this point
Send a message via AIM to crawforddavid2006 Send a message via MSN to crawforddavid2006
ok i tried this but it gives String[] Array in the combo box

[php]
sr1 = new StreamReader("c:\\collection.txt");
string myString = sr1.ReadToEnd();
sr1.Close();
comboBox1.Items.Add(myString.Split('\n'));
[/php]
__________________
Quote:
Originally Posted by DaWei View Post
Well, it's better than Pen Islands url....;)

crawforddavid2006 is offline   Reply With Quote
Old Sep 11th, 2006, 11:35 PM   #16
Ooble
I eat cake for breakfast.
 
Ooble's Avatar
 
Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 9 Ooble is on a distinguished road
You have to add them one at a time, I'm afraid.

csharp Syntax (Toggle Plain Text)
  1. foreach (string Line in myString.Split('\n'))
  2. {
  3. comboBox1.Items.Add(Line);
  4. }
__________________
Me :: You :: Them
Ooble is offline   Reply With Quote
Old Sep 12th, 2006, 11:41 AM   #17
Jason Isom
Programmer
 
Join Date: Dec 2005
Posts: 53
Rep Power: 3 Jason Isom is on a distinguished road
Quote:
Originally Posted by Ooble View Post
You have to add them one at a time, I'm afraid.

csharp Syntax (Toggle Plain Text)
  1. foreach (string Line in myString.Split('\n'))
  2. {
  3. comboBox1.Items.Add(Line);
  4. }
Can't you do the following:

csharp Syntax (Toggle Plain Text)
  1. string myString = System.IO.File.ReadAllText("c:\\collection.txt");
  2. comboBox1.Items.AddRange(myString.Split('\n'));
Jason Isom is offline   Reply With Quote
Old Sep 12th, 2006, 1:56 PM   #18
crawforddavid2006
Expert Programmer
 
crawforddavid2006's Avatar
 
Join Date: Apr 2005
Location: Not sure yet
Posts: 582
Rep Power: 0 crawforddavid2006 is an unknown quantity at this point
Send a message via AIM to crawforddavid2006 Send a message via MSN to crawforddavid2006
Thanks Jason_Isom. Your suggestion worked.
__________________
Quote:
Originally Posted by DaWei View Post
Well, it's better than Pen Islands url....;)

crawforddavid2006 is offline   Reply With Quote
Old Sep 12th, 2006, 2:14 PM   #19
crawforddavid2006
Expert Programmer
 
crawforddavid2006's Avatar
 
Join Date: Apr 2005
Location: Not sure yet
Posts: 582
Rep Power: 0 crawforddavid2006 is an unknown quantity at this point
Send a message via AIM to crawforddavid2006 Send a message via MSN to crawforddavid2006
I lied... that is not the end of my problems . What Jason said does work but it leaves a little rectangle shape after each line. I tried using \b after the \n but it will not accept that. Any Ideas?
__________________
Quote:
Originally Posted by DaWei View Post
Well, it's better than Pen Islands url....;)

crawforddavid2006 is offline   Reply With Quote
Old Sep 12th, 2006, 4:02 PM   #20
MBirchmeier
Hobbyist Programmer
 
Join Date: Oct 2005
Posts: 211
Rep Power: 3 MBirchmeier is on a distinguished road
Quote:
Originally Posted by crawforddavid2006 View Post
I lied... that is not the end of my problems . What Jason said does work but it leaves a little rectangle shape after each line. I tried using \b after the \n but it will not accept that. Any Ideas?
The split removes the \n if that's what your splitting on. Is it possible the \n you're getting is an 0x0D 0x0A and you're only removing the 0x0A ?

Here's two suggestions, do a .Trim on all of the elements (which would still require looping) or before the split replace the 0x0D 0x0A's with 0x0A's so that the split on \n works properly.

-MBirchmeier
MBirchmeier is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
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 On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
3 language combo. Nebula Coder's Corner Lounge 9 Dec 19th, 2005 1:34 PM
anoying problem with a combo box cloud- Visual Basic 12 May 28th, 2005 1:20 PM
Java Combo Boxes Vengeance Java 0 May 4th, 2005 9:02 AM
What are advantages of Data Combo and data list over simple combo and list box? sham Visual Basic 1 Apr 12th, 2005 4:11 AM
combo box in form.. cloud- HTML / XHTML / CSS 5 Mar 15th, 2005 3:21 PM




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 4:19 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC