HELP!!! I've tried everything: \n, \r, Chr(10), Chr(13), Environment.NewLine, & <br />. I can't seem to produce a carriage return. What am I missing? Please see the below code.
If e.Row.RowType = DataControlRowType.Header Then
Dim dtTimePeriod As Date = CDate(txtPeriod.Text)
DirectCast(e.Row.FindControl("dateSun"), TextBox).Text = "SUN<br />" & dtTimePeriod.AddDays(-6).ToString("MM/dd")
DirectCast(e.Row.FindControl("dateMon"), TextBox).Text = "MON\n" & dtTimePeriod.AddDays(-5).ToString("MM/dd")
DirectCast(e.Row.FindControl("dateTue"), TextBox).Text = "TUE" & Environment.NewLine & dtTimePeriod.AddDays(-4).ToString("MM/dd")
DirectCast(e.Row.FindControl("dateWed"), TextBox).Text = "WED" & Chr(10) & dtTimePeriod.AddDays(-3).ToString("MM/dd")
DirectCast(e.Row.FindControl("dateThu"), TextBox).Text = "THU" & Chr(13) & dtTimePeriod.AddDays(-2).ToString("MM/dd")
DirectCast(e.Row.FindControl("dateFri"), TextBox).Text = "FRI" & Chr(13) & dtTimePeriod.AddDays(-1).ToString("MM/dd")
DirectCast(e.Row.FindControl("dateSat"), TextBox).Text = "SAT" & Chr(13) & dtTimePeriod.ToString("MM/dd")
End If
Mike Vytal
Member
122 Points
100 Posts
New Line not working
Jan 23, 2013 10:23 PM|LINK
HELP!!! I've tried everything: \n, \r, Chr(10), Chr(13), Environment.NewLine, & <br />. I can't seem to produce a carriage return. What am I missing? Please see the below code.
If e.Row.RowType = DataControlRowType.Header Then Dim dtTimePeriod As Date = CDate(txtPeriod.Text) DirectCast(e.Row.FindControl("dateSun"), TextBox).Text = "SUN<br />" & dtTimePeriod.AddDays(-6).ToString("MM/dd") DirectCast(e.Row.FindControl("dateMon"), TextBox).Text = "MON\n" & dtTimePeriod.AddDays(-5).ToString("MM/dd") DirectCast(e.Row.FindControl("dateTue"), TextBox).Text = "TUE" & Environment.NewLine & dtTimePeriod.AddDays(-4).ToString("MM/dd") DirectCast(e.Row.FindControl("dateWed"), TextBox).Text = "WED" & Chr(10) & dtTimePeriod.AddDays(-3).ToString("MM/dd") DirectCast(e.Row.FindControl("dateThu"), TextBox).Text = "THU" & Chr(13) & dtTimePeriod.AddDays(-2).ToString("MM/dd") DirectCast(e.Row.FindControl("dateFri"), TextBox).Text = "FRI" & Chr(13) & dtTimePeriod.AddDays(-1).ToString("MM/dd") DirectCast(e.Row.FindControl("dateSat"), TextBox).Text = "SAT" & Chr(13) & dtTimePeriod.ToString("MM/dd") End IfThanx,
M2
**Why curse the darkness, when you can light a candle...**
Rion William...
All-Star
26980 Points
4465 Posts
Re: New Line not working
Jan 23, 2013 10:34 PM|LINK
Does the TextBox that you are using have TextMode set to "MultiLine"?
Mike Vytal
Member
122 Points
100 Posts
Re: New Line not working
Jan 23, 2013 11:24 PM|LINK
Rion, thanks for responding. Your suggestion along with Chr(10) worked!!!
Thanx,
M2
**Why curse the darkness, when you can light a candle...**
makwei88
Member
498 Points
115 Posts
Re: New Line not working
Jan 23, 2013 11:32 PM|LINK
try
DirectCast(e.Row.FindControl("dateSun"), TextBox).Text = "SUN" & System.Environment.NewLine & dtTimePeriod.AddDays(-6).ToString