Monday, October 27, 2008

creating a SaveFileDialog

private void button1_Click(object sender, System.EventArgs e)
{
Stream myStream ;
SaveFileDialog saveFileDialog1 =
new SaveFileDialog();

saveFileDialog1.Filter =
"txt files (*.txt)|*.txt|All files (*.*)|*.*" ;
saveFileDialog1.FilterIndex = 2 ;
saveFileDialog1.RestoreDirectory =
true ;

if(saveFileDialog1.ShowDialog() == DialogResult.OK)
{
if((myStream = saveFileDialog1.OpenFile()) != null)
{
// Code to write the stream goes here.
myStream.Close();
}
}
}

Thursday, October 9, 2008

to calculate date time

date Time event and code for calculating day and validate start date nd end date



private void dateTimePickerEnd_ValueChanged(object sender, EventArgs e)
{
dateTimePickerEnd.MinDate = dateTimePickerStart.Value;

DateTime start = DateTime.Parse(dateTimePicker1.Text);
DateTime end = DateTime.Parse(dateTimePicker2.Text);
//dateTimePicker2.MinDate = dateTimePicker1.Value;
if (end.Day >= start.Day)
{
TimeSpan ts = end.Subtract(start);
string ss = ts.TotalDays.ToString();

string s = ts.Days.ToString();
textBox1.Text = (s);
//string time = new DateTime(ts.Ticks);
//MessageBox.Show(time);
}

About Dot Net

I love dot net ...this one of very great platform for software developer, which give comprehensive
tools and other thing to develop good software . During coding we lack in some way ,here we can help each other to shout out some problem and also we can share some ideas too