Click here to Skip to main content
15,903,201 members
Home / Discussions / C#
   

C#

 
GeneralRe: save drop down box items in a text file Pin
S. Senthil Kumar5-Jun-05 6:24
S. Senthil Kumar5-Jun-05 6:24 
GeneralRe: save drop down box items in a text file Pin
Carsten Zeumer5-Jun-05 6:43
Carsten Zeumer5-Jun-05 6:43 
GeneralRe: save drop down box items in a text file Pin
S. Senthil Kumar5-Jun-05 6:55
S. Senthil Kumar5-Jun-05 6:55 
GeneralRe: save drop down box items in a text file Pin
Carsten Zeumer5-Jun-05 8:02
Carsten Zeumer5-Jun-05 8:02 
Generalif a certain item exist in a drop down box Pin
Farhad Eft5-Jun-05 5:29
Farhad Eft5-Jun-05 5:29 
GeneralRe: if a certain item exist in a drop down box Pin
S. Senthil Kumar5-Jun-05 6:54
S. Senthil Kumar5-Jun-05 6:54 
GeneralRe: if a certain item exist in a drop down box Pin
Farhad Eft5-Jun-05 10:42
Farhad Eft5-Jun-05 10:42 
GeneralRe: if a certain item exist in a drop down box [edited] Pin
DavidNohejl5-Jun-05 12:15
DavidNohejl5-Jun-05 12:15 
Farhad Eftekhari wrote:
but this code returns an error:

Which one? It would be easier to help if you said what exactly that error says. (with stack trace if possible!)

Farhad Eftekhari wrote:
how can i convert my label text to an item?

You don't. If your drpSelected.Items contains array of string, than it works. If it does not, item text (displayed in control) are result of item's ToString() method. Now think about it. What Contains method need to find your item? It must be able to say if some item from items is (equals) to item you are searching for. So, in order to make THIS example work, you can a) have only strings in drpSelected.Items (so Contains will compare string references) or b) override Equals() method for items or c) if( drpSelected.Items.Contains( item ) ). First option seems to be best, but then again we have no idea what your code *really* means.

[edit]
or you can create new item (e.g if( drpSelected.Items.Contains( new item(lblID.Text) ) ) )+ override Equals(). But that sounds quite stupid Smile | :)

hmmm it looks like your drop has something to do with IDs? I suspect your Item have properties Item.UserName and Item.ID, right? Don't you need only selected one? Than use SelectedValue instead of SelectedText. (you must fors say what is Value "column" -ListControl.DataValueField Property[^] )
[/edit]

Does it help?

David
Questionc# and exchange ? Pin
Tee+5-Jun-05 4:44
Tee+5-Jun-05 4:44 
AnswerRe: c# and exchange ? Pin
Nick Parker5-Jun-05 9:10
protectorNick Parker5-Jun-05 9:10 
GeneralRe: c# and exchange ? Pin
Tee+5-Jun-05 17:29
Tee+5-Jun-05 17:29 
GeneralRe: c# and exchange ? Pin
Corinna John6-Jun-05 1:15
Corinna John6-Jun-05 1:15 
GeneralDataset insert new row Pin
webhay5-Jun-05 2:11
webhay5-Jun-05 2:11 
Generaluse DefWindowProc in c# Pin
Sasuko5-Jun-05 0:55
Sasuko5-Jun-05 0:55 
GeneralRe: use DefWindowProc in c# Pin
Carsten Zeumer5-Jun-05 3:35
Carsten Zeumer5-Jun-05 3:35 
GeneralRe: use DefWindowProc in c# Pin
Sasuko5-Jun-05 4:36
Sasuko5-Jun-05 4:36 
GeneralRe: use DefWindowProc in c# Pin
Carsten Zeumer5-Jun-05 5:22
Carsten Zeumer5-Jun-05 5:22 
GeneralRe: use DefWindowProc in c# Pin
DavidNohejl5-Jun-05 6:23
DavidNohejl5-Jun-05 6:23 
GeneralRe: use DefWindowProc in c# Pin
Carsten Zeumer5-Jun-05 6:33
Carsten Zeumer5-Jun-05 6:33 
GeneralRe: use DefWindowProc in c# Pin
DavidNohejl5-Jun-05 7:17
DavidNohejl5-Jun-05 7:17 
GeneralRe: use DefWindowProc in c# Pin
Sasuko5-Jun-05 6:39
Sasuko5-Jun-05 6:39 
GeneralRe: use DefWindowProc in c# Pin
Carsten Zeumer5-Jun-05 10:12
Carsten Zeumer5-Jun-05 10:12 
GeneralRe: use DefWindowProc in c# Pin
Sasuko5-Jun-05 11:21
Sasuko5-Jun-05 11:21 
GeneralRe: use DefWindowProc in c# Pin
Carsten Zeumer5-Jun-05 11:33
Carsten Zeumer5-Jun-05 11:33 
GeneralRe: use DefWindowProc in c# Pin
Sasuko5-Jun-05 12:53
Sasuko5-Jun-05 12:53 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.