Saturday, September 25, 2010

Tuesday, November 10, 2009

C# Extended methods

We can create methods for classes that haven't source code.For this we can use extended methods. For example: We have to classes Class1, Class2. Class1 haven't open source code. In Class 2 we can create method for Class1.

static class Class2
{
public static string GetClassType(this Class1 myclass)
{
return myclass.GetType().ToString();
}

}

After we can use it such way
Class1.GetClassType()

Friday, October 23, 2009

To Read XML Data in the DataGridView

This code will allow you to read the data from the XML file and display it in the datagridview.

DataSet ds = new DataSet();
private void Form1_Load(object sender, EventArgs e)
{
ds.ReadXml(“Data.xml”);
dataGridView1.DataSource = ds.Tables[0];
}


To Delete a Row from the DataGridView use the Following Code

private void button1_Click(object sender, EventArgs e)
{
dataGridView1.Rows.RemoveAt(rIndex);
}
int rIndex;
private void dataGridView1_RowEnter(object sender, DataGridViewCellEventArgs e)
{
rIndex = e.RowIndex;
}

The XML File is as Follows

<School>

<student>

<rNumber>1rNumber>

<SName>HefinSName>

<SMarks1>100SMarks1>

<SMarks2>50SMarks2>

<SMarks3>70SMarks3>

student>

School>

Thursday, November 1, 2007

T-SQL: DISTINCT

Если в релляционое таблице значение некоторого столбца повторяются то можно использовать оператор языка T-SQL: DISTINCT для получения уникальных значений

SELECT DISTINCT Customers.CompanyName From Customers
INNER JOIN Orders ON Customers.CustomerID=Orders.CustomerID

Thursday, October 11, 2007

Welcome to the Microsoft.net blog. Here you can find best articles about .NET technology