Click here to Skip to main content
15,891,943 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
dateTimePicker1.Value.ToString() = prop.AdmissionYear;

What I have tried:

dateTimePicker1.Value.ToString() = prop.AdmissionYear;
Posted
Updated 13-Jun-18 6:43am
Comments
F-ES Sitecore 13-Jun-18 10:59am    
ToString is a function that returns something, you can't assign a value to it. Go through tutorials using the dateTimePicker and you'll probably find what it is you're trying to do. If it's to set the year or default year there is probably a property for that, or at least a default date property you can then update the year on. Consult the documentation.
Member 13847218 13-Jun-18 11:50am    
ok pls how do work coding send decod dateTimePicker

 
Share this answer
 
Comments
Member 13847218 13-Jun-18 12:08pm    
Error 1 Cannot implicitly convert type 'string' to 'System.Windows.Forms.DateTimePicker'
pls solution
Richard MacCutchan 13-Jun-18 12:11pm    
Neither your original question, nor that message make any sense. Follow the link above and learn how to use the DateTimePicker.
Richard MacCutchan 13-Jun-18 12:35pm    
I have no idea what that is supposed to mean. It is not even valid C# code. As I said, follow the link above and study the class that you are trying to use.
There are loads of things wrong with that code...
dateTimePicker1.Value.ToString() = prop.AdmissionYear;
Strings are immutable, so quite what you expect to happen when you try to assign a string object a new value I don;t know. You can assign a value to a string variable, but not to an object.

Dates are not just a year: they have months and days as well. So you probably want to use the year to generate a "proper" date which would be around the start of the academic year:
C#
dateTimePicker1.Value = new DateTime(int.Parse(prop.AdmissionYear), 9, 1);
 
Share this answer
 
Comments
Member 13847218 30-Jun-18 8:02am    
how do c# encode button textbox value file name save ..
example textbox =001 file name 001 save jpeg
decode button search open file textbox value display
OriginalGriff 30-Jun-18 8:14am    
You need to ask that as a new question - but not like that!
That's meaningless without a whole load of context we just don't have - we only get exactly what you type to work from.

So post it as a new question, but don't try to type as little as possible - the more information you actually give us, the better an answer we can give.
Member 13847218 10-Jul-18 0:56am    
how do student id,name,address encode by input filename student id value save format qrcode than decode search texbox studentid value enter. display value student id ,name, address
c# windows application
OriginalGriff 10-Jul-18 1:42am    
Two things:
1) Stop trying to type as little as possible: the better the information you give us, the better the answer we can give you.
2) Ask a new question instead of trying to "piggy back" on an existign question. That way you will reach a wider audience and that often gives you better , quicker, responses.

Ask here: https://www.codeproject.com/Questions/ask.aspx

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