Friday, 28 December 2012

Find a folder with Visual Studio project

 In the Solution Explorer right-click on the solution name and select "Open folder in windows explorer"

Check internet connection

System.Net.WebClient   //Name space

Solutions 1:  
Public Void InternetConnCheck()
{     
     try
     { 
        WebClient Client=new WebClient ();
       Using (var stream = client.OpenRead("http://www.google.com")
       {       
           Messagebox.show("Connection is Open"); 
       }
     catch
     {
          Messagebox.show("Connection Not available");  
     }   

}

Solutions 2: 

Public Void InternetConnCheck()
{     
     try 
     {       
       System.Net.IPHostEntry i = System.Net.Dns.GetHostEntry("www.google.com");
               Messagebox.show("Connection available");        
     }
     catch
     { 
        Messagebox.show("Connection Not available"); 
     }  

}

Solutions 3: 
bool InternetConnection = new Ping().Send
                          ("www.google.co.in").Status == IPStatus.Success;

Thursday, 27 December 2012

Check database connection is open or close

Solutions 1: 
OledbConnString = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=C:\test.mdb";
OleDbConnection Conn = new OleDbConnection(OledbConnString);
if (Conn.State == Conn.Open)
{
     Messagebox.show("Connection is Open");
}
else
{
     Messagebox.show("Connection is Close");
}

Tuesday, 25 December 2012

How to install East Asian language in Windows XP without CD

Solutions 1:   
1.  Download East Asian Language pack and extract files to a local folder  
2. Go to Start menu
3. Click Run
4.  Type"intl.cpl" and click OK
5. Choose tab “Languages”
6. check the “Install files for East Asian languages".

7. Choose Extract File Path
8. Choose "XJIS.NL_"

9.  Reboot System
10.  Repeat step 2,3,4,5
11. Click button “Details”.


12.Click button “Add”

13. You will see “Add Input Language” dialogue box. Choose “Korean” from dropdownlist.
14. You will see in “Korean” language part, the keyboard part is now has “Korean”. 
15. Click on the language to choose different input. You will see there are two input services. KO for Korean, and EN for English. Choose “Korean”.

Monday, 24 December 2012

DataGridView Search & Focusing a Search row

Solutions 1:    
private void button1_Click(object sender, EventArgs e)
{
            dataGridView1.ClearSelection();
            String searchValue = textBox1.Text;  //Textbox1 -> Search Key Word
            int rowIndex = -1;
            foreach (DataGridViewRow row in dataGridView1.Rows)
            {
                if (row.Cells[1].Value != null)
                {
                    if (row.Cells[1].Value.ToString().ToLower().Equals(searchValue.ToLower()))
                    {
                        rowIndex = row.Index;                       
                        dataGridView1.Rows[rowIndex].Selected = true;
                        dataGridView1.FirstDisplayedScrollingRowIndex = rowIndex;                       
                        break;
                    }
                }
            }
        }


Null before ToString() Checking

Solutions 1:   
if (entry.Properties["something"].Value != null) 
{ 
}

Thursday, 20 December 2012

Get the field names of a MS access database table

Solutions : 
using System.Data.OleDb;  //namespace


OledbConnString="Provider=Microsoft.Jet.OLEDB.4.0; Data Source="C:\\dbBCR.mdb";
            OleDbConnection Conn = new OleDbConnection(OledbConnString);
            Conn.Open();
            OleDbCommand Command = new OleDbCommand("select * from Table1", Conn);
            OleDbDataReader reader = Command.ExecuteReader();
            DataTable schemaTable = reader.GetSchemaTable();
                        foreach (DataRow row in schemaTable.Rows)
            {
                  MessageBox.Show(row.Field<string>("ColumnName"));
             }
            Conn.Close();