Date and time will automatically display

Posted by suri1319-13143 under C# on 12/29/2011 | Points: 10 | Views : 1410 | Status : [Member] | Replies : 3
Hi My Dear firends....
i am working on windows application in that i have five columns are there those columns names are (Slno, Select (check box), ID, Name, Date )
in that i want enter only ID, Name, remaining Slno, and date will automatically displaying fields with press tab key.
with it that I have six buttons are there(ADD, DELETE,UPDATE,TODAY,MONTH,SHOWALL) when i will press ADD button inserted records(one or more) all are ADD to the database table.
if i will click on DELETE button only checked records will be deleted.
if i will click on TODAY only today records will be display.
if i will click on MONTH it will ask enter the month then month records only will be show in the data gridview.
if i will click on SHOW ALL all records will be show in the data grid view
these are my requirement please help me are mail to me suri1319@gmail.com




Responses

Posted by: Naraayanan on: 12/29/2011 [Member] Starter | Points: 25

Up
0
Down
hi,
please send your requirement screen.

Regards,
Lakshmi Naraayanan.S
http://dotnettechrocks.blogspot.in/
http://abaprocker.blogspot.com/

suri1319-13143, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: suri1319-13143 on: 12/30/2011 [Member] Starter | Points: 25

Up
0
Down
Hi Naraayanan.....
very thank full to your proper response. I am sending my sample windows application please once check and send back code to me please save my time please.... my Email id suri1319@gamil.com
 Download source file

suri1319-13143, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Naraayanan on: 12/30/2011 [Member] Starter | Points: 25

Up
0
Down
Hi Suri,
I just finished your (1,4,8) and Please try to yourself any problem please send it . Nice Weekend and Happy New year to all Members and Administrator.
Code
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 Gridview
{
public partial class frmgridview : Form
{
#region Declaration Part
public static DateTime currentDt = DateTime.Now;

#endregion Declaration Part
public frmgridview()
{
InitializeComponent();
}

private void lblitemno_Click(object sender, EventArgs e)
{

}

private void cmbitemno_SelectedIndexChanged(object sender, EventArgs e)
{

}

private void lblitemname_Click(object sender, EventArgs e)
{

}

private void cmbitemname_SelectedIndexChanged(object sender, EventArgs e)
{

}

private void btnadd_Click(object sender, EventArgs e)
{

int day = currentDt.Day;
int month = currentDt.Month;
int year = currentDt.Year;
string currentdate = Convert.ToString(day) + "/" + Convert.ToString(month) + "/" + Convert.ToString(year);
dgvdisplay.CurrentRow.Cells[0].ReadOnly = true;
dgvdisplay.CurrentRow.Cells[2].Value = cmbitemno.Text;
dgvdisplay.CurrentRow.Cells[2].ReadOnly = true;
dgvdisplay.CurrentRow.Cells[3].Value = cmbitemname.Text;
dgvdisplay.CurrentRow.Cells[3].ReadOnly = true;
dgvdisplay.CurrentRow.Cells[4].Value =currentdate;
dgvdisplay.CurrentRow.Cells[4].ReadOnly = true;
dgvdisplay.CurrentRow.Cells[5].Selected = true;
for (int cnt = 0; cnt < dgvdisplay.Rows.Count; cnt++)
{
if (cnt == 0)
{
dgvdisplay.CurrentRow.Cells[0].Value = 1;
}
else if (cnt > 0)
{
dgvdisplay.CurrentRow.Cells[0].Value = Convert.ToUInt32(dgvdisplay.CurrentRow.Cells[0].Value) + 1;
}
}

numbercolumns();


}

private void btn_ADD_Click(object sender, EventArgs e)
{

}

private void btnupdate_Click(object sender, EventArgs e)
{

}

private void btndelete_Click(object sender, EventArgs e)
{

}

private void btntoday_Click(object sender, EventArgs e)
{

}

private void btnmonth_Click(object sender, EventArgs e)
{

}

private void btnshowall_Click(object sender, EventArgs e)
{

}

private void frmgridview_Load(object sender, EventArgs e)
{
dgvdisplay.Focus();
}

private void numbercolumns()
{

dgvdisplay.CurrentRow.Cells[5].Value = "0.00";
dgvdisplay.CurrentRow.Cells[6].Value = "0.00";
dgvdisplay.CurrentRow.Cells[7].Value = "0.00";
dgvdisplay.CurrentRow.Cells[8].Value = "0.00";
dgvdisplay.CurrentRow.Cells[9].Value = "0.00";



}

private void dgvdisplay_CurrentCellChanged(object sender, EventArgs e)
{
double price;
double quality;
double tax;
double discount;
double Total;
double grossTotal;
double reduced;
quality = Convert.ToDouble(dgvdisplay.CurrentRow.Cells[5].Value);
price = Convert.ToDouble(dgvdisplay.CurrentRow.Cells[6].Value);
grossTotal = quality * price;
discount = Convert.ToDouble(dgvdisplay.CurrentRow.Cells[7].Value);
tax = Convert.ToDouble(dgvdisplay.CurrentRow.Cells[8].Value);
reduced = discount + tax;
Total = grossTotal - reduced;
dgvdisplay.CurrentRow.Cells[9].Value = Total;



}

private void dgvdisplay_CellValidating(object sender, DataGridViewCellValidatingEventArgs e)
{

}
public void CellValidation(object sender, System.Windows.Forms.KeyPressEventArgs e)
{

string strval = dgvdisplay .CurrentCell.EditedFormattedValue.ToString();

if (strval.Length <= 6)
{

if (System.Convert.ToInt32(e.KeyChar) == System.Convert.ToInt32('\r')) //Enter key
{

e.Handled = true;

}

else if (System.Convert.ToInt32(e.KeyChar) == System.Convert.ToInt32('\b')) //Backspace
{

}

else if (System.Convert.ToInt32(e.KeyChar) >= 48 && System.Convert.ToInt32(e.KeyChar) <= 57)

//Negative sign, Decimal and Numbers
{

}

else
{

e.Handled = true;

}

}

if (strval.Length >= 6)
{

if (System.Convert.ToInt32(e.KeyChar) == System.Convert.ToInt32('\b')) //Backspace
{

}

else if (System.Convert.ToInt32(e.KeyChar) >= 48 && System.Convert.ToInt32(e.KeyChar) <= 57)

//Negative sign, Decimal and Numbers
{

if (strval.Length >= 3)
{

strval = "";

e.Handled = true;

}

}

else
{

e.Handled = true;

}

return;

}

}

private void dgvdisplay_EditingControlShowing(object sender, DataGridViewEditingControlShowingEventArgs e)
{
e.Control.KeyPress += CellValidation;
}
}
}



Regards,
Lakshmi Naraayanan.S
http://dotnettechrocks.blogspot.in/
http://abaprocker.blogspot.com/

suri1319-13143, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response