what is the equivalent function of len in vb6 in c #? example is:

VB:
string s;
s = len(txt1.text)

what is len's equivalent function in csharp?

Recommended Answers

Hi
In C#, string.Length property returns the length of the string similar to Len() function in vb.

int iLength;
  string s = "C# Programming";

  iLength = s.Length;
Jump to Post

All 3 Replies

Hi
In C#, string.Length property returns the length of the string similar to Len() function in vb.

int iLength;
  string s = "C# Programming";

  iLength = s.Length;
string s;
s = textBox1.Text.Length.ToString();

string strlen;
strlen=txtstr.txt.Length.tostring(); // if u r directly taking from the textbox control.

string strlen;
strlen=somestring.Length;// in general

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.