472,982 Members | 2,381 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,982 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 16182
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...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
tracyyun
by: tracyyun | last post by:
Hello everyone, I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
2
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
3
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
3
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...
0
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...
0
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
4
by: GKJR | last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...

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.