473,385 Members | 1,673 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Combining 2 Fields Using ListBox.DataTextField

I have a ListBox control which I am using with databinding. However, the
text that I want to be displayed is a combination of two fields (in this
case, first and last names). What do I enter as the DataTextField property
to combine these two fields? Thanks.
--
Nathan Sokalski
nj********@hotmail.com
http://www.nathansokalski.com/
Nov 19 '05 #1
3 6259
Well, for a general purpose answer... this should work.

list.DataTextField = string.Forma("{0}, {1}", FirstNameVar, LastNameVar);

FirstNameVar and LastNameVar are string variables or you could use really
anything, I'm sure you get the basic idea.
HTH
-Darren Kopp
http://blog.secudocs.com/

"Nathan Sokalski" <nj********@hotmail.com> wrote in message
news:ei**************@tk2msftngp13.phx.gbl...
I have a ListBox control which I am using with databinding. However, the
text that I want to be displayed is a combination of two fields (in this
case, first and last names). What do I enter as the DataTextField property
to combine these two fields? Thanks.
--
Nathan Sokalski
nj********@hotmail.com
http://www.nathansokalski.com/

Nov 19 '05 #2
oops, string.Format.

-Darren

"Darren Kopp" <da******************@gmail.com> wrote in message
news:OR**************@TK2MSFTNGP15.phx.gbl...
Well, for a general purpose answer... this should work.

list.DataTextField = string.Forma("{0}, {1}", FirstNameVar, LastNameVar);

FirstNameVar and LastNameVar are string variables or you could use really
anything, I'm sure you get the basic idea.
HTH
-Darren Kopp
http://blog.secudocs.com/

"Nathan Sokalski" <nj********@hotmail.com> wrote in message
news:ei**************@tk2msftngp13.phx.gbl...
I have a ListBox control which I am using with databinding. However, the
text that I want to be displayed is a combination of two fields (in this
case, first and last names). What do I enter as the DataTextField property
to combine these two fields? Thanks.
--
Nathan Sokalski
nj********@hotmail.com
http://www.nathansokalski.com/


Nov 19 '05 #3
Nathan you coould do that in SQL
Hope that helps
Patrick

"Nathan Sokalski" <nj********@hotmail.com> wrote in message
news:ei**************@tk2msftngp13.phx.gbl...
I have a ListBox control which I am using with databinding. However, the
text that I want to be displayed is a combination of two fields (in this
case, first and last names). What do I enter as the DataTextField property
to combine these two fields? Thanks.
--
Nathan Sokalski
nj********@hotmail.com
http://www.nathansokalski.com/

Nov 19 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: dixie | last post by:
I have an extended multi-select list box of names in which the bound column is a person ID field called ID (text, not numerical). I want that list to act as a parameter in a query that is...
1
by: Scott | last post by:
This is probably something really easy, Well I hope anyhow. I have three fields used for barcoding, in one table F1, F2 and F3. I want the three fields to be able to be combined to complete an...
6
by: DS | last post by:
I have a Combo Box (Fiield 2 is the seen one, field 1 is the bound one) and I want to combine it with another field on a report. The new field should only be visible whenever the Amount field is...
1
by: Adhiraj | last post by:
Hi, I come from Java background. I waant to know the C# equivalent to JList in Java. I tried using ListBox but cud not work out how to add elements to it. i.e. there is no method like...
2
by: musosdev | last post by:
Hi guys I have an asp:ListBox on my form, which I'm populating with a DataReader, using DataSource/DataBind. The problem is that the main field I want to use for DataTextField, "Company" in...
4
by: l7alabeh | last post by:
Hi, I am trying to take from a database 3 values, concatenate the first two of them and insert them in a ListBox (in the DataTextField) and the 3rd value in the DataValueField. The problem is...
2
by: vanz10 | last post by:
I everyone, i'm a bigenner when talking about php so that is why I'm asking someone who knows the code if how to view the data by using listbox
2
by: rpeacock | last post by:
I have a function that takes a field with values separated by commas within the field and splits them to multiple rows. Example: Field - Interior Value - abc,def,efg,ghi Output: ID Item 1 ...
0
by: sijugeo | last post by:
Hi, I Have a MS word template field which have certain data fields. I want to populate the data fields using the data retrived from SQL db. How can I do this? Thanks in advance Siju george
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.