i have tried the following into a rich text box:
ClockBox.AppendText(String.Format("{0}", DateTime.Now));
thank you!




Posted 29 December 2010 - 05:29 AM
ClockBox.AppendText(DateTime.Now.ToString());
This post has been edited by CodingSup3rnatur@l-360: 29 December 2010 - 05:33 AM
Posted 29 December 2010 - 05:38 AM
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
public double salePrice { get; private set; }
public double discountPrice { get; private set; }
public double vat { get; private set; }
public double onlyVat { get; private set; }
public double totalPrice { get; private set; }
public double changeGiven { get; private set; }
public double payment { get; private set; }
public double subtotal { get; private set; }
private void ClockBox_TextChanged(object sender, EventArgs e)
{
ClockBox.AppendText(DateTime.Now.ToString());
}
private void calcPriceAndDiscount_Click(object sender, EventArgs e)
{
double salePrice;
double subtotal;
double discountPrice;
VATBox.AppendText("20");
if (String.IsNullOrWhiteSpace(DiscountBox.Text))
{
DiscountBox.AppendText("0");
}
if (double.TryParse(PriceBox.Text, out salePrice))
{
if(double.TryParse(DiscountBox.Text, out discountPrice))
{
subtotal = (salePrice - discountPrice);
SubtotalBox.AppendText(String.Format("{0:c}", subtotal));
this.calcPriceAndDiscount.Enabled = false;
}
}
else
{
SubtotalBox.AppendText("Could not be calculated!");
}
}
private void calcWithVat_Click(object sender, EventArgs e)
{
double salePrice;
double subtotal;
double discountPrice;
double onlyVat;
double totalPrice;
double vat = 20.00;
if (double.TryParse(PriceBox.Text, out salePrice))
{
if (double.TryParse(DiscountBox.Text, out discountPrice))
{
subtotal = (salePrice - discountPrice);
if (double.TryParse(VATBox.Text, out vat))
{
onlyVat = (subtotal / 100.00 * vat);
totalPrice = (onlyVat + subtotal);
FinalPriceBox.AppendText(String.Format("{0:c}", totalPrice));
calcWithVat.Enabled = false;
}
}
}
else
{
FinalPriceBox.AppendText("Could not be calculated!");
}
}
private void calcPaymentMinPrice_Click(object sender, EventArgs e)
{
double changeGiven;
double payment;
double salePrice;
double subtotal;
double discountPrice;
double onlyVat;
double totalPrice;
double vat = 20.00;
if (double.TryParse(PriceBox.Text, out salePrice))
{
if (double.TryParse(DiscountBox.Text, out discountPrice))
{
subtotal = (salePrice - discountPrice);
if (double.TryParse(VATBox.Text, out vat))
{
onlyVat = (subtotal / 100.00 * vat);
totalPrice = (onlyVat + subtotal);
if (double.TryParse(PaymentBox.Text, out payment))
{
changeGiven = (payment - totalPrice);
ChangeGivenBox.AppendText(String.Format("{0:c}", changeGiven));
calcPaymentMinPrice.Enabled = false;
}
else
{
PaymentBox.AppendText("Please enter payment amount!");
}
}
}
}
}
private void PrintButton_Click(object sender, EventArgs e)
{
if (String.IsNullOrWhiteSpace(this.PaymentBox.Text) || String.IsNullOrWhiteSpace(this.SubtotalBox.Text)
|| String.IsNullOrWhiteSpace(this.VATBox.Text) || String.IsNullOrWhiteSpace(this.FinalPriceBox.Text)
|| String.IsNullOrWhiteSpace(this.PaymentBox.Text) || String.IsNullOrWhiteSpace(this.ChangeGivenBox.Text))
{
return;
}
else
{
PrintButton.Enabled = false;
MessageBox.Show("Printing Receipt!");
Application.Exit();
}
}
private void AbortButton_Click(object sender, EventArgs e)
{
}
}
}
This post has been edited by simagen: 29 December 2010 - 05:53 AM
Posted 29 December 2010 - 07:18 AM
|
|
Query failed: connection to localhost:3312 failed (errno=111, msg=Connection refused).
|
