Solving problem of Line seperation from sqlqury result message in c# MessageBox
hi ,to day i am posting how c# Message box will display messagetext when message text coming from Database and when messagetext coming from UI
1) C# Message Box showing message of Line separation from UI;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void btn_Save_Click(object sender, EventArgs e)
{
string messsage = "Test1... \n Test2'";
MessageBox.Show(messsage);
}
}
}
Output Result:
2) When Message to display from Data Base Query:-
DECLARE @LINEBREAK AS varchar(2)
SET @LINEBREAK ='Test1' +CHAR(13) + CHAR(10)+'Test2';
Means above here char(13),char(10) are line breaking in sqlserver
clearly in general way char(13)+char(10)='\n'
No comments:
Post a Comment