Click here to Skip to main content
15,920,217 members
Home / Discussions / Visual Basic
   

Visual Basic

 
AnswerRe: How to Add Two Different Strings to same Index In a Combobox - .NET1.1 Pin
ChandraRam9-Dec-08 2:13
ChandraRam9-Dec-08 2:13 
AnswerRe: How to Add Two Different Strings to same Index In a Combobox - .NET1.1 Pin
Tom Deketelaere9-Dec-08 2:55
professionalTom Deketelaere9-Dec-08 2:55 
GeneralRe: How to Add Two Different Strings to same Index In a Combobox - .NET1.1 Pin
Puneet Bhatnagar10-Dec-08 2:11
Puneet Bhatnagar10-Dec-08 2:11 
GeneralRe: How to Add Two Different Strings to same Index In a Combobox - .NET1.1 Pin
Tom Deketelaere10-Dec-08 2:25
professionalTom Deketelaere10-Dec-08 2:25 
GeneralRe: How to Add Two Different Strings to same Index In a Combobox - .NET1.1 Pin
Puneet Bhatnagar11-Dec-08 1:49
Puneet Bhatnagar11-Dec-08 1:49 
GeneralRe: How to Add Two Different Strings to same Index In a Combobox - .NET1.1 Pin
Tom Deketelaere11-Dec-08 2:08
professionalTom Deketelaere11-Dec-08 2:08 
GeneralError Message Pin
Puneet Bhatnagar11-Dec-08 16:17
Puneet Bhatnagar11-Dec-08 16:17 
AnswerRe: How to Add Two Different Strings to same Index In a Combobox - .NET1.1 Pin
riced9-Dec-08 3:15
riced9-Dec-08 3:15 
If you use string3 = string1 + string2 you won't be able to hide the second string.
You need to put the strings into an object that has two fields and add this object to the ComboBox. You could then use the DisplayMember property to show only the first field. Alternatively, you could override the ToString() function to display only the first field.

Something like the following should do it.

Public Class TheData
   'Public for simplicity but should be properties
   Public firstString As String
   Public secondString As Sting
   
   Public Overrides Function ToString() As String
      return firstString
   End Function
End Class


In your code to populate the combobox you would need something like this.

Dim d As TheData = new TheData()
d.firstString = "Puneet"
d.secondString = "India"
me.cboProject.Items.Insert(0, d)  ' or me.cboProject.Items.Add(d)


There might be an easier way but I can't think of one (it's a breeze in MS Access because the combobox control has multiple columns that you can show or hide.)
David Rice
GeneralRe: How to Add Two Different Strings to same Index In a Combobox - .NET1.1 Pin
Jon_Boy11-Dec-08 4:27
Jon_Boy11-Dec-08 4:27 
GeneralFacing Problem while retrieving Pin
Puneet Bhatnagar11-Dec-08 17:53
Puneet Bhatnagar11-Dec-08 17:53 
GeneralRe: Facing Problem while retrieving Pin
riced12-Dec-08 5:21
riced12-Dec-08 5:21 
GeneralRe: Facing Problem while retrieving Pin
riced16-Dec-08 0:05
riced16-Dec-08 0:05 
GeneralRe: How to Add Two Different Strings to same Index In a Combobox - .NET1.1 Pin
Luc Pattyn9-Dec-08 3:35
sitebuilderLuc Pattyn9-Dec-08 3:35 
Questionvisual basic Pin
jayachandra.c8-Dec-08 19:51
jayachandra.c8-Dec-08 19:51 
AnswerRe: visual basic Pin
Christian Graus8-Dec-08 21:11
protectorChristian Graus8-Dec-08 21:11 
AnswerRe: visual basic Pin
~Khatri Mitesh~9-Dec-08 0:37
~Khatri Mitesh~9-Dec-08 0:37 
AnswerRe: visual basic Pin
Jon_Boy9-Dec-08 3:32
Jon_Boy9-Dec-08 3:32 
Questioncode to save editable data from MSFlexgid to database in vb 6.0. [modified] Pin
sumit52838-Dec-08 19:45
sumit52838-Dec-08 19:45 
AnswerRe: code to save editable data from MSFlexgid to database. Pin
Christian Graus8-Dec-08 21:12
protectorChristian Graus8-Dec-08 21:12 
QuestionCommunication between computers... Pin
Subjugate8-Dec-08 19:00
Subjugate8-Dec-08 19:00 
AnswerRe: Communication between computers... Pin
Steven J Jowett9-Dec-08 0:11
Steven J Jowett9-Dec-08 0:11 
GeneralRe: Communication between computers... Pin
Subjugate9-Dec-08 16:14
Subjugate9-Dec-08 16:14 
GeneralRe: Communication between computers... Pin
Steven J Jowett10-Dec-08 1:33
Steven J Jowett10-Dec-08 1:33 
GeneralRe: Communication between computers... Pin
Subjugate10-Dec-08 14:14
Subjugate10-Dec-08 14:14 
QuestionVideo Implementation Pin
Johndas8-Dec-08 18:40
Johndas8-Dec-08 18:40 

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.