Wrox Programmer Forums
|
ASP.NET 1.0 and 1.1 Basics ASP.NET discussion for users new to coding in ASP.NET 1.0 or 1.1. NOT for the older "classic" ASP 3 or the newer ASP.NET 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old December 5th, 2005, 01:31 AM
Authorized User
 
Join Date: Aug 2003
Posts: 52
Thanks: 0
Thanked 0 Times in 0 Posts
Default New line prob

Hi

I have a listbox and a textbox corresponding to it.
The listbox is populated from the database.
The user can either type manually in the textbox or click on any value in the listbox. The clicking should place that value in the textbox. To separate different values my code is:


Code:
private void lstExam_SelectedIndexChanged(object sender, System.EventArgs e)
{
String strtmp="";
strtmp += txtExam.Text;
strtmp += Environment.NewLine+lstExam.SelectedItem.Text;
txtExam.Text=strtmp;
}
Once the user clicks on update button, the value of textbox is saved into database. There is also a print button which prints a form pertaining to these values.

Problem:
1)The values fetched from SQL SERVER doesnt contain newlines.
How to identify the newline in SQL Server data ?
2) What if the SQL Server data is to be placed in the textarea and the data should be in different lines appropriately?


Regards,

Vinay


 
Old December 6th, 2005, 02:24 PM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

You can identify newlines in any string by looking for the Environment.NewLine character in it. You should be able to assign a string with newlines to a multi-line textbox web control without any modification to the data and the new lines should show appropriately.

-Peter





Similar Threads
Thread Thread Starter Forum Replies Last Post
How to draw indicator line in owc line chart AlexOo General .NET 0 July 9th, 2007 10:32 PM
Reading a string from line by line vaidyapragati ASP.NET 2.0 Professional 1 May 3rd, 2007 08:43 AM
How to read file line by line in EVC++ iriskab Visual C++ 0 September 27th, 2006 01:39 PM
Reading line by line from a .txt file x_ray VB.NET 2002/2003 Basics 5 February 10th, 2006 01:55 PM
how can i take line by line in the richtextbox kamarajraj Beginning VB 6 0 August 12th, 2005 04:29 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.