I am using a combobox.. and I want to display two columns combobox using the diplay member property...for example I have a table sam and it has two columns A and B .
following are details of column A
A
---
1
2
3
following are the details of column B
B
---
4
5
6
Now I want to display them into combobox as following...
1
2
3
4
5
6
13 Replies - 3442 Views - Last Post: 17 December 2010 - 07:56 AM
#1
display two columns sequentiallly in combobox using display member pro
Posted 17 December 2010 - 05:48 AM
Replies To: display two columns sequentiallly in combobox using display member pro
#2
Re: display two columns sequentiallly in combobox using display member pro
Posted 17 December 2010 - 05:51 AM
So you want to fetch all records from a column and another column and display them together?
#3
Re: display two columns sequentiallly in combobox using display member pro
Posted 17 December 2010 - 06:11 AM
#4
Re: display two columns sequentiallly in combobox using display member pro
Posted 17 December 2010 - 06:19 AM
foreach (var record in FetchFromColumnA() as string)
{
comboBox1.Items.Add(record);
}
foreach (var record in FetchFromColumnB() as string)
{
comboBox1.Items.Add(record);
}
You'll have to implement the Fetch methods but that's easy enough.
Can you tell us why you want to do something like this? Maybe we can suggest a better solution.
#5
Re: display two columns sequentiallly in combobox using display member pro
Posted 17 December 2010 - 06:26 AM
Sergio Tapia, on 17 December 2010 - 05:19 AM, said:
foreach (var record in FetchFromColumnA() as string)
{
comboBox1.Items.Add(record);
}
foreach (var record in FetchFromColumnB() as string)
{
comboBox1.Items.Add(record);
}
You'll have to implement the Fetch methods but that's easy enough.
Can you tell us why you want to do something like this? Maybe we can suggest a better solution.
The purpose of doing so is that ,,, I want the user to select any record from both of these fields that are being displayed in combobox using displayMember property but I will get its userID (this is column name that I kept in valueMember field)
Any way thanks for the code but could you please give it in C#...because I don not know vb...
#6
Re: display two columns sequentiallly in combobox using display member pro
Posted 17 December 2010 - 06:33 AM
From a UX standpoint, it'd be better to have two separate comboBoxes and properly label them. You'd still be giving the user the options to get the UserID however they want, but not confuse them.
That's very confusing to look at and will probably be counter productive.
ComboBox1 --------- sergio lucas george boston roslindale austin
That's very confusing to look at and will probably be counter productive.
#7
Re: display two columns sequentiallly in combobox using display member pro
Posted 17 December 2010 - 06:37 AM
Quote
foreach (var record in FetchFromColumnA() as string)
{
comboBox1.Items.Add(record);
}
foreach (var record in FetchFromColumnB() as string)
{
comboBox1.Items.Add(record);
}
Any way thanks for the code but could you please give it in C#...because I don not know vb..
That IS C#!
Copy, paste, repeat, eh?
#8
Re: display two columns sequentiallly in combobox using display member pro
Posted 17 December 2010 - 06:47 AM
Sergio Tapia, on 17 December 2010 - 05:33 AM, said:
From a UX standpoint, it'd be better to have two separate comboBoxes and properly label them. You'd still be giving the user the options to get the UserID however they want, but not confuse them.
sergio what about code in c# ??
I told you that I don't understand vb...
plz give me it in c#..
That's very confusing to look at and will probably be counter productive.
ComboBox1 --------- sergio lucas george boston roslindale austin
sergio what about code in c# ??
I told you that I don't understand vb...
plz give me it in c#..
That's very confusing to look at and will probably be counter productive.
#9
Re: display two columns sequentiallly in combobox using display member pro
Posted 17 December 2010 - 06:58 AM
You forgot to post code or text. You just quoted me.
#10
Re: display two columns sequentiallly in combobox using display member pro
Posted 17 December 2010 - 07:05 AM
I am talking about the code you provided...
following code
following code
foreach (var record in FetchFromColumnA() as string)
{
comboBox1.Items.Add(record);
}
foreach (var record in FetchFromColumnB() as string)
{
comboBox1.Items.Add(record);
}
#11
Re: display two columns sequentiallly in combobox using display member pro
Posted 17 December 2010 - 07:18 AM
That's not visual basic code. That's C#, the code won't work because the Fetch methods aren't implemented. Are you just copy pasting the code?
#12
Re: display two columns sequentiallly in combobox using display member pro
Posted 17 December 2010 - 07:41 AM
#13
Re: display two columns sequentiallly in combobox using display member pro
Posted 17 December 2010 - 07:55 AM
#14
Re: display two columns sequentiallly in combobox using display member pro
Posted 17 December 2010 - 07:56 AM
Page 1 of 1
|
|

New Topic/Question
Reply




MultiQuote




|