473,399 Members | 3,919 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,399 software developers and data experts.

Display Multiple Rows in TextBox

Hi all,

How do I display multiple database rows in the one textBox?

The textBox is bound to the Database table and should display 3 database values.

However it displays only one.

How do I join table rows??

e.g. My table has 3 rows with same ID and want them all displayed in textBox...

myField ID
----------------- ---------------
itemA 2
itemB 2
itemC 2

thanks.
May 30 '07 #1
10 16215
Hi all,

How do I display multiple database rows in the one textBox?

The textBox is bound to the Database table and should display 3 database values.

However it displays only one.

How do I join table rows??

e.g. My table has 3 rows with same ID and want them all displayed in textBox...

myField ID
----------------- ---------------
itemA 2
itemB 2
itemC 2

thanks.
Set the "Multiline" property of the TextBox to true. Then you can display whatever you want.
Or you could use a RichTextBox instead.
May 30 '07 #2
Tried "Multiline" but no difference.

The textBox is bound to a dataset but only one row is displayed in it.
May 30 '07 #3
Tried "Multiline" but no difference.

The textBox is bound to a dataset but only one row is displayed in it.
Hmmm, never used a TextBox in that way. Have you tried to see how the RichTextBox behaves?
May 30 '07 #4
Hmmm, never used a TextBox in that way. Have you tried to see how the RichTextBox behaves?

hi ,
please try to set the textmode is "multiline" for corresponding textbox its working.

Thanks,
http://www.tryangled.com
http://www.tryangled.net
http://iteamweb.com
May 30 '07 #5
Plater
7,872 Expert 4TB
I am not sure you can use a texbox in that mannor, it's possible, but seems counter-intuitive. You have uniquely seperated lines that you just want to jumble into a big textbox
If you just wish to display the data, a ListBox might be a better fit.
Or you could make a middleman function in between what your database returns and what your textbox gets bound to. That function would read in all the data from the database and mush it into the textbox.
May 30 '07 #6
Frinavale
9,735 Expert Mod 8TB
Tried "Multiline" but no difference.

The textBox is bound to a dataset but only one row is displayed in it.
Is the problem that the data from the database is being displayed:
"itemA 2 itemB 2 itemC 2"

Or is it that you're only displaying:
"itemA 2"

You may have to put "new lines" in after each row retrieved from the database?
How are you filling the textbox?
May 30 '07 #7
Is the problem that the data from the database is being displayed:
"itemA 2 itemB 2 itemC 2"

Or is it that you're only displaying:
"itemA 2"

You may have to put "new lines" in after each row retrieved from the database?
How are you filling the textbox?
it's only displaying "itemA"

I want it to display itemA,itemB,itemC
Do I have to use a loop for this??

TextBox is bound to a dataset.
Using Visual Studio 2005. DataBindings Text Property set as... fundsAffectedEditBindingSource - myFunds
May 31 '07 #8
Vidhura
99
Suggestion:
Instead you could do the concatenation in db itself as follows



declare @abbr varchar(1000)

select @abbr=COALESCE(@abbr+ ',', '')+Col1 from Table where ID=@ID
select @abbr




it's only displaying "itemA"

I want it to display itemA,itemB,itemC
Do I have to use a loop for this??

TextBox is bound to a dataset.
Using Visual Studio 2005. DataBindings Text Property set as... fundsAffectedEditBindingSource - myFunds
May 31 '07 #9
Frinavale
9,735 Expert Mod 8TB
it's only displaying "itemA"

I want it to display itemA,itemB,itemC
Do I have to use a loop for this??

TextBox is bound to a dataset.
Using Visual Studio 2005. DataBindings Text Property set as... fundsAffectedEditBindingSource - myFunds
Check out this .NET article on how to use a database in your program. Try using the examples in your program...especially look at the section on "Executing Your SQL Commands". The only change you'll have to make is to add a loop that looks like:
Expand|Select|Wrap|Line Numbers
  1. While myDataReader.Read
  2.           TextBox1.Text = TextBox1.Text + " " + CType( dr.Item("FieldName"), String)
  3. End While
  4.  
Hope this helps you!

-Frinny
May 31 '07 #10
Adanik
1
Select list box instead of text box and choose property called row sources and choose what ever table field you like it will allow you to display multiple values from same field
Mar 18 '09 #11

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Tom | last post by:
Hi I want to display the DB data in a tabcontrol. There is a textbox insides that tabcontrol <code private void Bind_DBData( string strSql = "select * from table WHERE id > 0 order by id"...
18
by: Alpha | last post by:
Hi, I'm working on a Windows applicaton with VS 2003 on windows 2000. I have a listbox that I have binded to a dataset table, "source" which has 3 columns. I would like to display 2 of those...
4
by: Joe Van Meer | last post by:
Hi, Is the datalist meant for one table or can I use it to display information from 2 different tables? Or should I be looking at a datagrid instead? I began my code and kinda ran into a snag...
0
by: michael | last post by:
Hi all, i want to know how to display multiple lines in one crystal report chart in asp.net i wrote some codes but it always display 2 lines in separate chart(please refer to the codes...
2
by: .Net Newbie | last post by:
Hello, I am currently coding my ASP.Net pages in c# and have run into a question concerning Emails. I have four objects on a page (six including 2 buttons). The first is a subject line...
2
by: assgar | last post by:
Hi Developemnt on win2003 server. Final server will be linux Apache,Mysql and PHP is being used. I use 2 scripts(form and process). The form displays multiple dynamic rows with chechboxs,...
3
by: gyap88 | last post by:
My search engine in visual basic 2005 has 4 textbox for users to input values, named textbox1,textbox2,textbox3,textbox4. I have a string assigned to each of the textbox named...
2
by: kurtzky | last post by:
i created a form that should function as follows: i will enter a number in a textbox..then it should query from the database all the records which has that number..these records will have a...
5
by: stoogots2 | last post by:
I have written a windows application that performs several functions (is multi threaded). I have a Textbox in the main window of the app which I want to display the contents of the logfile and...
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: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.