10/28/2014
9/18/2014
Date and Time Format Strings in C#
private void dateTimePicker1_ValueChanged(object sender, EventArgs e) { label15.Text = dateTimePicker1.Value.ToString("d"); label16.Text = dateTimePicker1.Value.ToString("D"); label17.Text = dateTimePicker1.Value.ToString("f"); label18.Text = dateTimePicker1.Value.ToString("F"); label19.Text = dateTimePicker1.Value.ToString("g"); label20.Text = dateTimePicker1.Value.ToString("G"); label21.Text = dateTimePicker1.Value.ToString("m"); label22.Text = dateTimePicker1.Value.ToString("r"); label23.Text = dateTimePicker1.Value.ToString("s"); label24.Text = dateTimePicker1.Value.ToString("t"); label25.Text = dateTimePicker1.Value.ToString("T"); label26.Text = dateTimePicker1.Value.ToString("u"); label27.Text = dateTimePicker1.Value.ToString("U"); label28.Text = dateTimePicker1.Value.ToString("y"); }
7/10/2014
Increment the value of Qty if row with the same data already exists in DataGridView
private void btn_Add_Click(object sender, EventArgs e) { //Boolean value to check if the DataGridView has the same value. bool Found = false; double total = Convert.ToDouble(txt_Price.Text) * 1; if (dataGridView1.Rows.Count > 0) { //Check if the product Name exists with the same Price foreach (DataGridViewRow row in dataGridView1.Rows) { if (Convert.ToString(row.Cells[0].Value) == txt_Name.Text && Convert.ToString(row.Cells[2].Value) == txt_Price.Text) { //Update the Quantity of the found row row.Cells[1].Value = Convert.ToString(1 + Convert.ToInt16(row.Cells[1].Value)); row.Cells[3].Value = Convert.ToDouble(row.Cells[1].Value) * Convert.ToDouble(row.Cells[2].Value); Found = true; } } if (!Found) { //Add the row to DataGridView if data not present dataGridView1.Rows.Add( txt_Name.Text,1, txt_Price.Text,total); } } else { //Add the first row to DataGridView if there is no row dataGridView1.Rows.Add( txt_Name.Text, 1, txt_Price.Text,total); } }
6/11/2014
5/28/2014
3/12/2014
CSS3 background-size Property
background-size: auto|length|cover|contain|initial|inherit;
#header
{
float: right;
width: 670px;
height: 200px;
background-image: url(' ');
background-position:center;
background-size:cover;
background-repeat: no-repeat;
}
2/01/2014
1/07/2014
C# Moving Label to the left and right
public partial class ScrollText : Form { public bool moveright = true; //This Variable should be declared globaly public ScrollText() { InitializeComponent(); } private void timer1_Tick(object sender, EventArgs e) { if (moveright == true) { lblScroll.Left += 5; } else { lblScroll.Left -= 5; } if (lblScroll.Left <= Convert.ToInt32(this.ClientRectangle.Left)) { moveright = true; } if (lblScroll.Left + lblScroll.Width >= Convert.ToInt32(this.ClientRectangle.Right)) { moveright = false; } } }
1/03/2014
Asp .Net Error 'The resource cannot be found'
Asp .Net Error 'The resource cannot be found' |
<configuration> <system.web> <compilation debug="true" targetFramework="4.5.1" /> <httpRuntime targetFramework="4.5.1" /> <customErrors mode="On" defaultRedirect="~/Errors/GeneralErrors.aspx"> <error statusCode="403" redirect="~/Errors/Error403.aspx"/> <error statusCode="404" redirect="~/Errors/Error404.aspx"/> <error statusCode="500" redirect="~/Errors/Error500.aspx"/> </customErrors> </system.web> </configuration>
1/02/2014
Asp .Net WebForms UnobtrusiveValidationMode requires a ScriptResourceMapping for 'jquery' Error
<configuration> <system.web> <compilation debug="true" targetFramework="4.5.1" /> <httpRuntime targetFramework="4.5.1" /> </system.web> <appSettings> <add key="ValidationSettings:UnobtrusiveValidationMode" value="None" /> </appSettings> </configuration>