Archive for the ‘dot Net’ Category

Transfer focus to button at run-time, if you have more than one buttons

Tuesday, December 15th, 2009
Code for ASP.Net in C#.Net:
TextBox1.Attributes.Add(“onkeydown”, “if(event.which || event.keyCode){if ((event.which == 13) || (event.keyCode == 13)) {document.getElementById(‘” + Button1.UniqueID + “‘).click();return false;}} else {return true}; “);

How to print contents of DataGridView

Friday, October 5th, 2007

Hi all,

I am developing a windows based application in C#.Net and using DataGridView 2.0 in my application. What the problem is, I need to print the contents of that dataGridView. I do search alot regarding that but no success.

Anyone having idea about that kindly reply me.

Thanx to all.

C#.Net: Apply Selection Formula in (.Net Builtin) Crystal Report 9

Monday, October 1st, 2007

//In the given code below, CrptInTransit is the name of calling report, and crystalReportViewer1 is use to display the report.

CrptInTransit report = new CrptInTransit();

report.RecordSelectionFormula = “{tblIntransit.ScrollDate} >= #” + DateFrom.ToShortDateString() + “# and {tblIntransit.ScrollDate} <= #” + DateTo.ToShortDateString() + “#”;

crystalReportViewer1.ReportSource = report;

C#.Net: How to Check/Uncheck the CheckBox in DataGridView1

Friday, September 28th, 2007

private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgse)
{
bool value = (bool)(this.dataGridView1.Rows[e.RowIndex].Cells[0].Value ?? false);
this.dataGridView1.Rows[e.RowIndex].Cells[0].Value = !value;
}