Archive for March, 2012

Number Only TextBox C# Windows Application

Put this code snippet your TextBox KeyPress Event, you will have your Number Only TextBox Working.


private void numberOnlyTextBox1_KeyPress(object sender, KeyPressEventArgs e)
{
 //allow digits only
 if (!char.IsControl(e.KeyChar) && !char.IsDigit(e.KeyChar) && e.KeyChar != '.')
 {
   e.Handled = true;
 }

 // allow one decimal point
 if (e.KeyChar == '.' && (sender as TextBox).Text.IndexOf('.') > -1)
 {
  e.Handled = true;
 }
}


Thanks
A Rahim Khan

Advertisements

Adding ReportParameter in Microsoft Report Viewer 2010

I Started using Microsoft Report these days, struggled a bit with ReportParameter. This following code shows how to use ReportParameter with Microsoft Report Viewer 2010.



Class1 cl1 = new Class1(); cl1.One = "1"; cl1.Two = "123"; cl1.Three = "123";
list.Add(cl1);

reportViewer1.LocalReport.ReportPath = @"E:\ImageExperiment\ImageExperiment\ImageExperiment\Report2.rdlc";

reportViewer1.LocalReport.EnableExternalImages = true;

List param1 = new List();
param1.Add(new ReportParameter("ReportParameter1", @"C:\a1.jpg"));
param1.Add(new ReportParameter("ReportParameter2", @"C:\a2.jpg"));
param1.Add(new ReportParameter("ReportParameter3", @"C:\a2.jpg"));
reportViewer1.LocalReport.SetParameters(param1);

Class1BindingSource.DataSource = list;

reportViewer1.RefreshReport();

Thanks
A Rahim Khan

Useful Linux Commands for Database Administrations

I am going to put together some useful Linux/AIX Commands for Database Administration.

 
$ echo $ORACLE_SID 
  oracleinstanceid 
# if you don't get any output, use this following one to set ORACLE_SID. 
$ export ORACLE_SID = oracleinstanceid 
# Now, check out ORACLE_HOME, PATH value. 
$ echo $ORACLE_HOME 
  oracle home directory 
$ echo $PATH 
  path value 

Continue reading