c#


Decimal in Windows Forms / declaring & textbox use


I'm rather new to c# and programming in general, started working on a windows forms app due to a project.
I have worker with strings and datatime types, but i'm not sure how i'm supposed to declare a decimal, and then use it in the textbox.
My testclass which works, but no decimal
internal class Customer
{
public string LastName { get; set; }
public string FirstName { get; set; }
public DateTime BirthDate { get; set; }
public Customer(string lastName, string firstName, DateTime birthDate)
{
LastName = lastName;
FirstName = firstName;
BirthDate = birthDate;
}
}
In the actual Form I use a foreach with the first column as the main item and then the next ones as subitems
var listViewItem = new ListViewItem(customer.LastName);
listViewItem.SubItems.Add(customer.FirstName);
listViewItem.SubItems.Add(customer.BirthDate.ToShortDateString());
So string is pretty straight forward, datetime gets .ToShortDateString(), what do I do with the damn decimal?
And when I add items to my form I use this for the button click event
string firstName = tbFirstName.Text;
string lastName = tbLastName.Text;
DateTime birthDate = dtpBirthDate.Value;
var customer = new Customer(lastName, firstName, birthDate);
_customers.Add(customer);
Same here, string gets.text, date gets .value but I really have no idea how to implement a decimal :/
Thanks and sorry if this badly structured, I'm on my phone and trying to copy snippets.

Related Links

EntityValidationErrors disappear after using Console.Write on each property
How to overcome stored cross site scripting vulnerability in Asp.net c#
Force linq sum to return null
Matching a string value to a value in an imported excel spreadsheet
How to build .csproj with C# 7 code from comand line (msbuild)
Principal.IsInRole returns different results for the same WindowsPrincipal, depending on how it is constructed
How to use Caliburn Micro's EventAggregator to send empty events (no payload)?
how to parse two column in string in one cycle?
List all MSSQL servers in the network VB.NET
Running the XAVWSample code from the UPS Developer
Select a Random Color from a List [closed]
Entity Framework - Oracle DB: Intermittently throws “ORA-12516, TNS:listener could not find available handler with matching protocol stack”
Generate bearer token client side C#
Clean way to find custom attributes on derived generic method override (when method is Async)
Task-based idle detection
closedxml to datatable without looping

Categories

HOME
asterisk
ssms
model-view-controller
azure-active-directory
ftp
alasql
ide
jenkins-pipeline
openacc
reference
postsharp
snmp
perl6
richtextbox
gnuradio
doctrine2
webpack-dev-server
wkhtmltopdf
ethereum
websharper
brightway
css-float
windows-phone
autologin
android-wifi
wai-aria
scrapy-spider
inspec
windows-mobile
stack-trace
setup-project
angular-schema-form
concrete5
undo
ios-autolayout
ng2-bootstrap
http-proxy
ansible-inventory
extern
yelp
pygraphviz
aspose.pdf
electron-packager
jvisualvm
google-cloud-powershell
pyexcel
cakephp-3.2
weld
anonymous-function
hierarchical-clustering
easyquery
stream-socket-client
evaluation
lucee
activesupport
xamarin-test-cloud
liferay-ide
printer-control-language
lightspeed
sqlproj
universe
jira-agile
init
vga
csc
innertext
alchemy
music-player
libgcrypt
hexagonal-tiles
callfire
euro
ultraedit
gmaps4jsf
maven-archetype
chrome-mobile
static-files
pysvn
drools-guvnor
fedena
nsnotificationcenter
ios-enterprise
drawable
debuggervisualizer
android-relativelayout
power-management
acrofields
boofcv
db2-connect
code-complete
xcode5.1
scidb
azure-pack
playing-cards
outlook-object-model
magicsuggest
pageload
simplemembership
django-tinymce
openafs
custom-cursor
erlide
win-prolog
inserthtml
code-organization
xpolog
windows-xp-embedded
funambol
file-processing
quazip
lgpl
database-agnostic
qprocess
webdb
authkit
software-update

Resources

Encrypt Message