Click here to Skip to main content
15,886,362 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
what is difference between textbox1.text = "" and textbox1.text = null and textbox1.text = string.empty . i need to know difference between this above three.
Posted
Updated 8-Oct-18 20:51pm
Comments
Member 11355751 14-Jan-15 2:00am    
my code is there, but i cannot count second white empty space pls help me.

using System;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Data.SqlClient;
using System.IO;





public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{

}
protected void Button1_Click(object sender, EventArgs e)
{

//string s3 = TextBox1.Text.ToString();
// string s3 = Server.MapPath("~/cibilguide.txt");
string path = @"C:\Users\vijayanarayanakumarm\Documents\Visual Studio 2008\Projects\CIBIL\cibilguide.txt";
//StreamReader sr = new StreamReader("");
using (StreamReader reader = new StreamReader(path))
{
string s3 = reader.ReadLine();





////for (int i = 0; i < s3.Length; i++)
////{

//// // MessageBox.Show(strOriginal[i].ToString());



////}


while ((s3 = reader.ReadLine()) != null)
{



string st = s3.Substring(0, 4); //1234
string ver = s3.Substring(4, 2); //12
string mrn = s3.Substring(6, 25);//1234567890123456789012345
// string fu = s3.Substring(31, 2);//12

//string em = s3.Substring(33, 30);//123456789012345678901234567890
//string epswd = s3.Substring(63, 30); //123456789012345678901234567890
//string epos = s3.Substring(93, 2);//12
//string eamt = s3.Substring(95, 09);//123456789
//string fus = s3.Substring(104, 3);//123
//string styp = s3.Substring(107, 02);//12
//string of = s3.Substring(109, 02);//12
//string rsz = s3.Substring(111, 1);//1
//string iom = s3.Substring(112, 02);//12
//string aum = s3.Substring(114, 01);//1



Response.Write("segement tag is :" + st + "<br />");

Response.Write("Version is :" + ver + "<br />");
Response.Write("mrn is :" + mrn + "<br />");
Response.Write("Future Use is :" + fu + "<br />");
//Response.Write("EM User ID is :" + em + "<br />");
//Response.Write("Epassword is :" + epswd + "<br />");
//Response.Write("E purpose is :" + epos + "<br />");
//Response.Write("E amount is :" + eamt + "<br />");
//Response.Write("Future use is :" + fus + "<br />");
//Response.Write("score type is :" + styp + "<br />");
//Response.Write("output format is :" + of + "<br />");
//Response.Write("Response size is :" + rsz + "<br />");
//Response.Write("input output method is :" + iom + "<br />");
//Response.Write("authdication met is :" + aum + "<br />");


// SqlConnection conn = new SqlConnection("Data Source=10.9.58.75;Initial Catalog=SampleDB;User ID=sa;Password=Chola@123");
// SqlCommand st1 = new SqlCommand("insert into cibil(SermentTag) values('" + @st + "')", conn);
// SqlCommand ver1 = new SqlCommand("insert into cibil(versionn) values('" + @ver + "')", conn);
// SqlCommand mrn1 = new SqlCommand("insert into cibil(MemberReference) values('" + @mrn + "')", conn);
// SqlCommand fu1 = new SqlCommand("insert int

string.empty is the same as "". Null probably renders the same, because what else can it do ? In ASP.NET, after a postback, there is definitely no difference between those three.
 
Share this answer
 
Comments
Member 10505468 8-Jan-14 1:13am    
I want bar code generation code using asp.net c#
Christian Graus 8-Jan-14 16:23pm    
OK, so write a ton of code, or use a library

What does that have to do with this question ?
textbox1.text = "" and textbox1.text = string.empty

both produce same results

textbox1.text = null


assigning some value to textbox1(if null is defined earlier)
 
Share this answer
 
Comments
Patrice T 23-Jan-17 2:39am    
2012 and was already answered
Member 13462315 15-Oct-17 5:23am    
I have a requirement that copying pdf files from local remote servers to in my computer .I have implemented application for that purpose. when I am running that application in visual studio working properly pdf files getting from local remote server mission. but when I am hosting this application in IIS and running then error comming that 'could not find path :Z://--------; actually I mapped the remote server drive in my local mission. Plz help me how to solve this
hi,

i want to calculate 3 text box values to automatic result in textbox4, and also this values are inserted to the database.
Please help me urgent.........
 
Share this answer
 
Comments
Richard Deeming 9-Oct-18 12:04pm    
What made you think that this question was a "solution" to someone else's question?!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900