Hello,
I am trying to find the equivalent of LEN in C#:
if (Len(this.ddlAudioDate.SelectedItem.Text) != 0)
Any help would be appreciated.
Thanks, sck10 9 8703
string s = "hello";
if (s.Length 0)
{
// do something
}
-- bruce (sqlwork.com)
"sck10" <sc***@online.nospamwrote in message
news:%2******************@TK2MSFTNGP06.phx.gbl...
Hello,
I am trying to find the equivalent of LEN in C#:
if (Len(this.ddlAudioDate.SelectedItem.Text) != 0)
Any help would be appreciated.
Thanks, sck10
Also in addition you still can use VB.NET Functions:
1)Add reference to Microsoft.VisualBasic Assembly "Microsoft.VisualBasic.dll"
2)Add "using" statement for namespace(s) you wish to use from
Microsoft.VisualBasic for example : "using Microsoft.VisualBasic"
3)you can find the functions you want inside modules and classes defined in
the namesapce(s) like Strings and Constants Modules
4) to use Len Call Strings.Len(YourVariable);
For more information review Microsoft.VisualBasic Namspace in MSDN
Regards
--
Muhammad Mosa
Software Engineer & Solution Developer
MCT/MCSD.NET
MCTS: .Net 2.0 Web Applications
MCTS: .Net 2.0 Windows Applications
"sck10" wrote:
Hello,
I am trying to find the equivalent of LEN in C#:
if (Len(this.ddlAudioDate.SelectedItem.Text) != 0)
Any help would be appreciated.
Thanks, sck10
int len = this.ddlAudioDate.SelectedItem.Text.Length;
It is a string, no? :-)
if(len != 0)
{
}
--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA
*************************************************
Think Outside the Box!
*************************************************
"sck10" <sc***@online.nospamwrote in message
news:%2******************@TK2MSFTNGP06.phx.gbl...
Hello,
I am trying to find the equivalent of LEN in C#:
if (Len(this.ddlAudioDate.SelectedItem.Text) != 0)
Any help would be appreciated.
Thanks, sck10
Muhammed,
You are right in that you CAN use this method, but why would you want
to, when these tools are all available natively in C#. What's the point
of learning a new (and far better IMHO) language, to step back in time
to these old constructs from another laguage as soon as something is
not obvious?
Regards
Adam
Muhammad Mosa wrote:
Also in addition you still can use VB.NET Functions:
1)Add reference to Microsoft.VisualBasic Assembly "Microsoft.VisualBasic.dll"
2)Add "using" statement for namespace(s) you wish to use from
Microsoft.VisualBasic for example : "using Microsoft.VisualBasic"
3)you can find the functions you want inside modules and classes defined in
the namesapce(s) like Strings and Constants Modules
4) to use Len Call Strings.Len(YourVariable);
For more information review Microsoft.VisualBasic Namspace in MSDN
Regards
--
Muhammad Mosa
Software Engineer & Solution Developer
MCT/MCSD.NET
MCTS: .Net 2.0 Web Applications
MCTS: .Net 2.0 Windows Applications
"sck10" wrote:
Hello,
I am trying to find the equivalent of LEN in C#:
if (Len(this.ddlAudioDate.SelectedItem.Text) != 0)
Any help would be appreciated.
Thanks, sck10
"CyberSpy" <Cy**********@gmail.comwrote in message
news:11**********************@h48g2000cwc.googlegr oups.com...
You are right in that you CAN use this method, but why would you want
to, when these tools are all available natively in C#. What's the point
of learning a new (and far better IMHO) language, to step back in time
to these old constructs from another laguage as soon as something is
not obvious?
I couldn't agree more! There is no reason whatsoever (other than sheer
laziness) to use the VB assembly...
Yes may be you are right, but in sometimes someone wants to use some VB.NET
fast out of the box Functionalities like Financials, FileIO. Also in Strings
there are some useful functions like RIGHT which is not availabe in string
class
Even I don't usually use it, but I see it as useful feature.
It is still something we should know, to use it or not, it is up to everyone
needs
--
Muhammad Mosa
Software Engineer & Solution Developer
MCT/MCSD.NET
MCTS: .Net 2.0 Web Applications
MCTS: .Net 2.0 Windows Applications
"CyberSpy" wrote:
Muhammed,
You are right in that you CAN use this method, but why would you want
to, when these tools are all available natively in C#. What's the point
of learning a new (and far better IMHO) language, to step back in time
to these old constructs from another laguage as soon as something is
not obvious?
Regards
Adam
Muhammad Mosa wrote:
Also in addition you still can use VB.NET Functions:
1)Add reference to Microsoft.VisualBasic Assembly "Microsoft.VisualBasic.dll"
2)Add "using" statement for namespace(s) you wish to use from
Microsoft.VisualBasic for example : "using Microsoft.VisualBasic"
3)you can find the functions you want inside modules and classes defined in
the namesapce(s) like Strings and Constants Modules
4) to use Len Call Strings.Len(YourVariable);
For more information review Microsoft.VisualBasic Namspace in MSDN
Regards
--
Muhammad Mosa
Software Engineer & Solution Developer
MCT/MCSD.NET
MCTS: .Net 2.0 Web Applications
MCTS: .Net 2.0 Windows Applications
"sck10" wrote:
Hello,
>
I am trying to find the equivalent of LEN in C#:
if (Len(this.ddlAudioDate.SelectedItem.Text) != 0)
>
Any help would be appreciated.
>
Thanks, sck10
>
>
>
Muhammed,
With components like Financials, I'm sure there are equivalent (or
newer/better) versions that can be found for the rare occasions it's
needed.
RIGHT is very easy to replicate:
string test = "abcdefghijklmnopqrstuvwxyz";
// Get the right most 10 chars
string right = test.Substring(test.Length - 10, 10));
It's not exactly much harder than using the RIGHT function, is it!
As to FileIO, .Net has a very rich set of features, and it's just a
case of learning the new syntax.
Rather than being 'something we should know', I think it should be seen
as 'something only to be used in an act of deperation, when all else
has failed, and you' can't be bothered to look for the correct
solution'! ;-)
I see you are an MCT - I hope you don't teach these techniques in your
classes!
Regards
Adam
Muhammad Mosa wrote:
Yes may be you are right, but in sometimes someone wants to use some VB.NET
fast out of the box Functionalities like Financials, FileIO. Also in Strings
there are some useful functions like RIGHT which is not availabe in string
class
Even I don't usually use it, but I see it as useful feature.
It is still something we should know, to use it or not, it is up to everyone
needs
--
Muhammad Mosa
Software Engineer & Solution Developer
MCT/MCSD.NET
MCTS: .Net 2.0 Web Applications
MCTS: .Net 2.0 Windows Applications
"CyberSpy" wrote:
Muhammed,
You are right in that you CAN use this method, but why would you want
to, when these tools are all available natively in C#. What's the point
of learning a new (and far better IMHO) language, to step back in time
to these old constructs from another laguage as soon as something is
not obvious?
Regards
Adam
Muhammad Mosa wrote:
Also in addition you still can use VB.NET Functions:
1)Add reference to Microsoft.VisualBasic Assembly "Microsoft.VisualBasic.dll"
2)Add "using" statement for namespace(s) you wish to use from
Microsoft.VisualBasic for example : "using Microsoft.VisualBasic"
3)you can find the functions you want inside modules and classes defined in
the namesapce(s) like Strings and Constants Modules
4) to use Len Call Strings.Len(YourVariable);
For more information review Microsoft.VisualBasic Namspace in MSDN
>
Regards
--
Muhammad Mosa
Software Engineer & Solution Developer
MCT/MCSD.NET
MCTS: .Net 2.0 Web Applications
MCTS: .Net 2.0 Windows Applications
>
>
"sck10" wrote:
>
Hello,
I am trying to find the equivalent of LEN in C#:
if (Len(this.ddlAudioDate.SelectedItem.Text) != 0)
Any help would be appreciated.
Thanks, sck10
"CyberSpy" <Cy**********@gmail.comwrote in message
news:11**********************@m79g2000cwm.googlegr oups.com...
Rather than being 'something we should know', I think it should be seen
as 'something only to be used in an act of desperation, when all else
has failed, and you' can't be bothered to look for the correct
solution'! ;-)
Quite so! Is anyone still using On Error in VB.NET...?
I see you are an MCT - I hope you don't teach these techniques in your
classes!
Indeed!
Well, I teach those techniques to VB.NET developers who wanted to learn C# or
switching to C# but they prefere to use some VB style modules.
And it is not good to be in a class and someone ask "Oh, Can I use Strings
Module in C#?" And the answet would be No! if he did some research he will
find that I've give him an incorrect answer. Even if this technique in your
opinion is not good, or bad, or whatever, it has no bad performance I think
as well as many people likes it.
After all, these techniques is used in Some MOCs Workshops Labs in C# and
VB.NET so it is till I have to face this, and C# developers who don't know
VB.NET and they are many, would ask "What is this?! An is there any other
mean to do it in C#?". It is just a knowledge that is why I said we should
Know. Still those techniques are managed .Net class libraries.
Regards
--
Muhammad Mosa
Software Engineer & Solution Developer
MCT/MCSD.NET
MCTS: .Net 2.0 Web Applications
MCTS: .Net 2.0 Windows Applications
"CyberSpy" wrote:
Muhammed,
With components like Financials, I'm sure there are equivalent (or
newer/better) versions that can be found for the rare occasions it's
needed.
RIGHT is very easy to replicate:
string test = "abcdefghijklmnopqrstuvwxyz";
// Get the right most 10 chars
string right = test.Substring(test.Length - 10, 10));
It's not exactly much harder than using the RIGHT function, is it!
As to FileIO, .Net has a very rich set of features, and it's just a
case of learning the new syntax.
Rather than being 'something we should know', I think it should be seen
as 'something only to be used in an act of deperation, when all else
has failed, and you' can't be bothered to look for the correct
solution'! ;-)
I see you are an MCT - I hope you don't teach these techniques in your
classes!
Regards
Adam
Muhammad Mosa wrote:
Yes may be you are right, but in sometimes someone wants to use some VB.NET
fast out of the box Functionalities like Financials, FileIO. Also in Strings
there are some useful functions like RIGHT which is not availabe in string
class
Even I don't usually use it, but I see it as useful feature.
It is still something we should know, to use it or not, it is up to everyone
needs
--
Muhammad Mosa
Software Engineer & Solution Developer
MCT/MCSD.NET
MCTS: .Net 2.0 Web Applications
MCTS: .Net 2.0 Windows Applications
"CyberSpy" wrote:
Muhammed,
>
You are right in that you CAN use this method, but why would you want
to, when these tools are all available natively in C#. What's the point
of learning a new (and far better IMHO) language, to step back in time
to these old constructs from another laguage as soon as something is
not obvious?
>
Regards
>
Adam
>
Muhammad Mosa wrote:
Also in addition you still can use VB.NET Functions:
1)Add reference to Microsoft.VisualBasic Assembly "Microsoft.VisualBasic.dll"
2)Add "using" statement for namespace(s) you wish to use from
Microsoft.VisualBasic for example : "using Microsoft.VisualBasic"
3)you can find the functions you want inside modules and classes defined in
the namesapce(s) like Strings and Constants Modules
4) to use Len Call Strings.Len(YourVariable);
For more information review Microsoft.VisualBasic Namspace in MSDN
Regards
--
Muhammad Mosa
Software Engineer & Solution Developer
MCT/MCSD.NET
MCTS: .Net 2.0 Web Applications
MCTS: .Net 2.0 Windows Applications
"sck10" wrote:
Hello,
>
I am trying to find the equivalent of LEN in C#:
if (Len(this.ddlAudioDate.SelectedItem.Text) != 0)
>
Any help would be appreciated.
>
Thanks, sck10
>
>
>
>
>
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Enos Meroka |
last post by:
Hallo,
I am a student doing my project in the university.. I have been trying
to compile the program using HP -UX aCC compiler, however I keep on
getting the following errors.
...
|
by: Mike L |
last post by:
Should the command call "using" be before or after my namespace?
**AFTER**
namespace DataGridBrowser
{
using System;
using System.Drawing;
using System.Drawing.Drawing2D;
using...
|
by: xzzy |
last post by:
I was wondering why we have to have
using System.Data
using System.Configuration
using etc....
why are they not all lumped into one 'using'?
In other words, is there a best way to use...
|
by: pmud |
last post by:
Hi,
I need to use an Excel Sheet in ASP.NET application so that the users can
enter (copy, paste ) large number of rows in this Excel Sheet. Also, Whatever
the USER ENETRS needs to go to the...
|
by: acb |
last post by:
Hi,
I wrote a DLL Component (using Visual Studio 2005) and managed to
include it into a C# Console application.
I am now trying to include this component into a Web project. I copy
the DLL...
|
by: Metal2You |
last post by:
I'm working on an ASP.NET 2.0 application in Visual Studio 2005 that
accesses a Sybase database back end. We're using Sybase SQL Anywhere
9.0.2.3228. I have installed and registered the Sybase...
|
by: mg |
last post by:
I'm migrating from VB6 and have a question about using 'Using' and the
best way to use it.
Here is a example of a small bit of code:
dbConx("open")
Using CN
Dim CMD As New OleDbCommand(sSQL,...
|
by: Eugene Anthony |
last post by:
The problem with my coding is that despite removing the records stored
in the array list, the rptPages repeater
control is still visible. The rptPages repeater control displayes the
navigation...
|
by: JDeats |
last post by:
I have some .NET 1.1 code that utilizes this technique for encrypting
and decrypting a file.
http://support.microsoft.com/kb/307010
In .NET 2.0 this approach is not fully supported (a .NET 2.0...
|
by: =?Utf-8?B?U2hhd24gU2VzbmE=?= |
last post by:
Greetings! I was researching AJAX to provide a solution to displaying status
messages while a long process executed. I found several examples online and
was able to use their code to get a quick...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
| |