XAML stands for extensible Application markup language, is variant of xml describing GUI. In winforms GUI framework was created in same language that you would use for interacting with the GUI like vb.net or c#.net.
.Net Code Examples, SQL Server Examples and Tutorials For All Technologies. Find what you want?
Tuesday, 26 May 2015
Sunday, 10 May 2015
Hello World in WPF- WPF Tutorial
In xaml:
<Window x:Class="WpfApplication1.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="350" Width="525">
<Grid>
<TextBlock HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="60">Hello World</TextBlock>
</Grid>
</Window>
After run program
For more info visit:
http://webxperts.co.in/
<Window x:Class="WpfApplication1.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="350" Width="525">
<Grid>
<TextBlock HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="60">Hello World</TextBlock>
</Grid>
</Window>
After run program
For more info visit:
http://webxperts.co.in/
Loop throuth all textboxes in Winforms
For iterating through all textboxes in winforms:
foreach (TextBox TextBox in this.Controls.OfType<TextBox>()) { if (TextBox.BackColor == Brushes.Green) { //your code } }
Sunday, 22 March 2015
Design Patterns:Three layred or Tiered architechture
This article will provide you the basic knowledge of Layered architecture.
What is layer- A layer is a reusable code that can be used any where, in any project.
in .net a layer is setup as a project.
We can have multiple layers to segregate our project.
We are going to discuss three layered architecture here. in three layered architecture we have three layers:
1.Data Access Layer
2.Business Logic Layer
3.Presentation Logic Layer
1.Data Access Layer(DAL)- Data access layer is basically used to interact with database. We use ado.net to access database in this layer. BAL layer interact with DAL to interact with database. BAL call DAL function to send and receive data to database.
2.Business Access Layer(BAL)-BAL layer is basically used to define business logic, calculations, conversions and all the stuff that is required by Presentation Layer.
3.Presentation Logic Layer- This layer is basically used for user interface. Presentation layer always interact to BAL layer for any data required or to send any data to database.
Benifits of layered architecture:
1.Easy to maintain of code. Because all layers are seperated from other so we can change to any layer easyily.
2.Reusability of code: We can use the code anywhere in the same project or any other project using reference.
3.Provide a segregated architecutre.
What is layer- A layer is a reusable code that can be used any where, in any project.
in .net a layer is setup as a project.
We can have multiple layers to segregate our project.
We are going to discuss three layered architecture here. in three layered architecture we have three layers:
1.Data Access Layer
2.Business Logic Layer
3.Presentation Logic Layer
1.Data Access Layer(DAL)- Data access layer is basically used to interact with database. We use ado.net to access database in this layer. BAL layer interact with DAL to interact with database. BAL call DAL function to send and receive data to database.
2.Business Access Layer(BAL)-BAL layer is basically used to define business logic, calculations, conversions and all the stuff that is required by Presentation Layer.
3.Presentation Logic Layer- This layer is basically used for user interface. Presentation layer always interact to BAL layer for any data required or to send any data to database.
Benifits of layered architecture:
1.Easy to maintain of code. Because all layers are seperated from other so we can change to any layer easyily.
2.Reusability of code: We can use the code anywhere in the same project or any other project using reference.
3.Provide a segregated architecutre.
Sunday, 15 February 2015
Ineterface with example in C#
Interface Definition: An interface is basically a contract or service which will implemented by other classes.
This implements the rules which will forced to use by derived classes.
Interface has only declarations of methods and properties. They do not have body in method they
have only the signatures.
Declaring Interfaces:
public interface IUser
{
void AddUser(User user);
void EditUser(int Id)
User GetUserByID(int Id);
}
Implementation:
public class User:IUser
{
public User GetUserByID(int Id)
{
var context=...................;
var user=context.Users.find(Id);
return user;
}
public EditUser(int Id)
{
var context=...................;
var user=context.Users.find(Id);
context.Entry(user).State=EntityState.Modified;
context.SaveChanges();
}
public void AddUser(User user)
{
var context=...................;
context.Users.Add(user);
context.SaveChanges();
}
}
This implements the rules which will forced to use by derived classes.
Interface has only declarations of methods and properties. They do not have body in method they
have only the signatures.
Declaring Interfaces:
public interface IUser
{
void AddUser(User user);
void EditUser(int Id)
User GetUserByID(int Id);
}
Implementation:
public class User:IUser
{
public User GetUserByID(int Id)
{
var context=...................;
var user=context.Users.find(Id);
return user;
}
public EditUser(int Id)
{
var context=...................;
var user=context.Users.find(Id);
context.Entry(user).State=EntityState.Modified;
context.SaveChanges();
}
public void AddUser(User user)
{
var context=...................;
context.Users.Add(user);
context.SaveChanges();
}
}
Thursday, 8 January 2015
How to add all the rows of a column to string with comma seperated
Introduction: Here we have to add all the rows of a column to string with comma seperated.
Description:I am going to use coalesce function of sql server to achieve the result.
Query:
DECLARE @Names VARCHAR(8000)
SELECT @Names = COALESCE(@Names + ',', '') + Name
FROM tbl_Names
print @Names
Description:I am going to use coalesce function of sql server to achieve the result.
Query:
DECLARE @Names VARCHAR(8000)
SELECT @Names = COALESCE(@Names + ',', '') + Name
FROM tbl_Names
print @Names
Monday, 29 December 2014
How to call javascript and jquery function from code behind in ASP.net and c#
Introduction: Here I will tell you how you can call javascript and jquery function
from codebehind.
Descirption:
Here I will tell you how you can call javascript and jquery function from codebehind.
If you are using scriptmanager on page then you can call
ScriptManager instance.
If you are not using script manager then you can call
Page.ClientScript instance
Implementation:
In Code Behind
protected void MyButton_Click(object sender, EventArgs e)
{
Page.ClientScript.RegisterStartupScript(this.GetType(), "myScript",
"MyFunction();", true);
}
protected void MyButton_Click(object sender, EventArgs e)
{
ScriptManager.RegisterStartupScript(this.GetType(), "myScript",
"MyFunction();", true);
}
Subscribe to:
Posts (Atom)

