473,468 Members | 1,358 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

convert.toString

I have datetime variable:

DateTime datum;

I set it and when I try to put it into a label:

labelDate.Text =datum.ToShortDateString;

I get an error:

Error 5 Cannot convert method group 'ToShortDateString' to non-delegate type
'string'. Did you intend to invoke the method?

I don't understand why this error?

labelDate.text is type of string and also datum.ToShortDateString should
return string.

It works if I use convert.toString function, but I don't know why I should
use convert function if both sides of equation are string?

Regards,Simon


Nov 17 '05 #1
4 13835
you () after ToShortDateString;

labelDate.Text =datum.ToShortDateString();

Nov 17 '05 #2
you () after ToShortDateString;

labelDate.Text =datum.ToShortDateString();

Nov 17 '05 #3
Hello simon,

Don't forget the () after you call the ToShortDateString() method.

-chris
I have datetime variable:

DateTime datum;

I set it and when I try to put it into a label:

labelDate.Text =datum.ToShortDateString;

I get an error:

Error 5 Cannot convert method group 'ToShortDateString' to
non-delegate type 'string'. Did you intend to invoke the method?

I don't understand why this error?

labelDate.text is type of string and also datum.ToShortDateString
should return string.

It works if I use convert.toString function, but I don't know why I
should use convert function if both sides of equation are string?

Regards,Simon


Nov 17 '05 #4
Hello simon,

Don't forget the () after you call the ToShortDateString() method.

-chris
I have datetime variable:

DateTime datum;

I set it and when I try to put it into a label:

labelDate.Text =datum.ToShortDateString;

I get an error:

Error 5 Cannot convert method group 'ToShortDateString' to
non-delegate type 'string'. Did you intend to invoke the method?

I don't understand why this error?

labelDate.text is type of string and also datum.ToShortDateString
should return string.

It works if I use convert.toString function, but I don't know why I
should use convert function if both sides of equation are string?

Regards,Simon


Nov 17 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: aevans1108 | last post by:
expanding this message to microsoft.public.dotnet.xml Greetings Please direct me to the right group if this is an inappropriate place to post this question. Thanks. I want to format a...
2
by: William Stacey | last post by:
Example line: string temp = Convert.ToString(null); Convert.ToString() says it will return empty string if null is passed as parm. This returns a null. Is this oversight in the Convert method?...
1
by: Mike | last post by:
Hi, I was wondering whether a difference existed between the Convert.ToString() method and the method ToString() that is sometimes available in some classes. Is one method preferred over another?...
3
by: Mark Kamoski | last post by:
Hi-- What is the difference between Convert.ToString(obj) and CType(obj, String)? (Assume obj is a variable of type Object.) Please advise. Thank you.
5
by: manmit.walia | last post by:
Hello All, I am stuck on a conversion problem. I am trying to convert my application which is written in VB.NET to C# because the project I am working on currently is being written in C#. I tried...
4
by: sck10 | last post by:
Hello, I am trying to test for IsNumeric using C# with the following: public bool IsNumeric(object TestValue) { try { int i = Convert.ToInt32(TestValue.ToString()); return true;
4
by: tshad | last post by:
I am trying to convert a string character to an int where the string is all numbers. I tried: int test; string stemp = "5"; test = Convert.ToInt32(stemp); But test is equal to 53.
9
by: myotheraccount | last post by:
Hello, Is there a way to convert a DataRow to a StringArray, without looping through all of the items of the DataRow? Basically, I'm trying to get the results of a query and put them into a...
2
by: DaveRook | last post by:
I have a question about the Convert.ToString vs ToString. Please find two lines of code: string dt = System.DateTime.Today.ToString("yy/dd/mm"); string date =...
0
Debadatta Mishra
by: Debadatta Mishra | last post by:
Introduction In this article I will provide you an approach to manipulate an image file. This article gives you an insight into some tricks in java so that you can conceal sensitive information...
1
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...
0
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...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
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...
1
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.