Showing posts with label VB.NET. Show all posts
Showing posts with label VB.NET. Show all posts
Thursday, February 1, 2007

Microsoft Application Block for .NET

It's dream of every developer to create a robust,efficient and fast solution for his client and Microsoft application blocks help greatly to develop a efficient,robust and n-tier applications.
Like every developer we want our solutions robust,efficient,cost effective and elegant. But as we all know sometimes it is not easy to achieve this goals. Microsoft application block help you achieve this goals in the great way.

Microsoft Pattern and Practices:

Since the late 90s there has been an increased awareness within Microsoft that its customers require guidance in using the quickly growing array of technology emanating from Redmond. Among the first efforts were a series of Prescriptive Architecture Guides (PAGs) that detailed how to use Microsoft technology to create an Internet data center (IDC) and enterprise data center (EDC). From that things micro soft has started a new group called Microsoft patterns and practices. This group help to achieve goals in best ways.

This group has build some libraries for Microsoft.net plate form called Microsoft application blocks to deliver highly efficient,robust solutions.

Typically, each application block includes the complete source code for the subsystem in both C# and VB, and sample applications called Quick Starts to get you started.

Following application blocks are created.

1) Data Access Application Blocks.
2) Exception Management Application Blocks.
3) Cryptography application blocks
4) Caching application blocks
5) Logging application blocks
6) Security application blocks.

All that application blocks are freely available for download. User can download and install it.

Following are the links for both versions 1.1 and 2.0 of Microsoft .NET Framework

Link for 1.1 Version:

http://www.microsoft.com/downloads/details.aspx?familyid=a7d2a109-660e-444e-945a-6b32af1581b3&displaylang=en

Link for 2.0 Version:

http://www.microsoft.com/downloads/details.aspx?familyid=5A14E870-406B-4F2A-B723-97BA84AE80B5&displaylang=en

Happy Programming
Share:

ASP.NET Case Studies

Today, ASP.NET is one of the most popular plate form for developing web application and Ajax enabled web sites and web application. ASP.NET Case Studies by Microsoft is mirror of the relevant world. You can find what the world are doing with asp.net and you can learn from their experiences.

Here is the link ASP.NET Case Studies.

http://msdn2.microsoft.com/en-us/asp.net/aa336563.aspx
Share:

ASP.NET Starter Kit For Visual Web Developer

The asp.net visual web developer starts kits are best way to start professional asp.net web programming. I have gone through several starter kits it's amazing.

The ASP.NET 2.0 Starter Kits for Visual Web Developer are fully functional sample applications to help you learn ASP.NET 2.0 and accomplish common Web development scenarios. Each sample is complete an dwell-documented so that you can use the code to kick start your Web projects today!
Any one can download this starter kits from the following link
http://www.asp.net/downloads/starterkits/default.aspx?tabid=62
Share:
Monday, January 22, 2007

Custom Gradient Button with hover Effect C#.NET

Any one create a gradient button with this example. Which have hover effect
class CustomButton:Button
{
#region Fields
private Color _StartColor;
private Color _EndColor;
private Color _StartHoverColor;
private Color _EndHoverColor;
private bool bMouseHover;
private Brush _paintBrush;
private PointF _centerPoint;
StringFormat _sf = new StringFormat();
#endregion
#region Properties
public Color StartColor
{
get
{
return _StartColor;
}
set
{
if (value == Color.Empty)
{
_StartColor = Color.FromArgb(251,250,249);
}
else
{
_StartColor = value;
}
}
}
public Color StartHoverColor
{
get
{
return _StartHoverColor;
}
set
{
if (value == Color.Empty)
{
_StartHoverColor =Color.White;
}
else
{
_StartHoverColor = value;
}
}
}
public Color EndHoverColor
{
get
{
return _EndHoverColor;
}
set
{
if (value == Color.Empty )
{
_EndHoverColor = Color.FromArgb(255,255,207) ;
}
else
{
_EndHoverColor = value;
}
}
}
public Color EndColor
{
get
{
return _EndColor;
}
set
{
if (value == Color.Empty)
{
_EndColor = Color.FromArgb(224,220,207);
}
else
{
_EndColor = value;
}
}
}
#endregion
#region Constructor
public CustomButton()
{
InitializeComponent();
bMouseHover = false;
_sf.Alignment = StringAlignment.Center;
_sf.FormatFlags = StringFormatFlags.DirectionRightToLeft;
}
#endregion
#region Methods
private void OnMouseEnter(object sender, System.EventArgs e)
{
bMouseHover = true;
Invalidate();
}
private void OnMouseLeave(object sender, System.EventArgs e)
{
bMouseHover = false;
Invalidate();
}
private void InitializeComponent()
{
this.MouseEnter += new System.EventHandler(this.OnMouseEnter);
this.MouseLeave += new System.EventHandler(this.OnMouseLeave);
}
protected override void OnPaint(PaintEventArgs pevent)
{
base.OnPaint(pevent);
Graphics g = pevent.Graphics;
if (bMouseHover == true)
{
_paintBrush = new LinearGradientBrush(this.ClientRectangle,this.StartHoverColor,this.EndHoverColor,LinearGradientMode.Vertical);
}
else
{
_paintBrush = new LinearGradientBrush(this.ClientRectangle, this.StartColor, this.EndColor, LinearGradientMode.Vertical);
}
g.FillRectangle(_paintBrush, this.ClientRectangle);
_paintBrush = new SolidBrush(this.ForeColor);
//this._centerPoint = new PointF((this.ClientRectangle.Left + this.ClientRectangle.Right) / 2,
// (this.ClientRectangle.Top + this.ClientRectangle.Bottom) / 2);
this._centerPoint = new PointF(this.Width / 2, this.Height / 2);
g.DrawString(this.Text,this.Font,_paintBrush, _centerPoint.X, _centerPoint.Y-5, _sf);
paint_Border(pevent);
}
private void paint_Border(PaintEventArgs e)
{
if (e == null)
return;
if (e.Graphics == null)
return;
Pen pen = new Pen(this.ForeColor, 1);
Point[] pts = border_Get(0, 0, this.Width - 1, this.Height - 1);
e.Graphics.DrawLines(pen, pts);
pen.Dispose();
}
private Point[] border_Get(int nLeftEdge, int nTopEdge, int nWidth, int nHeight)
{
int X = nWidth;
int Y = nHeight;
Point[] points =
{
new Point(1 , 0 ),
new Point(X-1 , 0 ),
new Point(X-1 , 1 ),
new Point(X , 1 ),
new Point(X , Y-1),
new Point(X-1 , Y-1),
new Point(X-1 , Y ),
new Point(1 , Y ),
new Point(1 , Y-1),
new Point(0 , Y-1),
new Point(0 , 1 ),
new Point(1 , 1 )
};
for (int i = 0; i < points.Length; i++)
{
points[i].Offset(nLeftEdge, nTopEdge);
}
return points;
}
#endregion
}
Share:
Friday, January 12, 2007

gradient background control

C#.Every time you need gradient background for a particular control to make your windows application look more visual and appelaing. I have written a code that might help you.
Thorugh this you can created gradient button,toolstrip and menustrip or any control that have background .

Following are code in C#.NET 2.0. Here the example is for menustrip but you can use it for any
control.


class GreenMenuStrip: MenuStrip
{
protected override void OnPaintBackground(PaintEventArgs e)
{
base.OnPaintBackground(e);
Graphics g = e.Graphics;
Rectangle bounds = new Rectangle(Point.Empty, this.Size);

if (bounds.Width > 0 && bounds.Height > 0)
{

using (Brush b = new LinearGradientBrush(bounds,Color.FromArgb
(183,214,183) , Color.FromArgb(221,235,221),
inearGradientMode.BackwardDiagonal))
{
g.FillRectangle(b, bounds);
}
}
}
}
Share:
Thursday, January 11, 2007

www.windowsforms.net- The Ultimate resource for windows forms

,I have found the most ultimate resource from Microsoft. The site called windows forms
which have all the information that a windows forms developer and smart client application
developer require.

it has following section

1) Get Started- where basic information is there for new windows forms developer.

2) Learn- Which has some great articles.

3) FAQ- This section contains all the questions that a windows application developer go through
with all the answers.

4) Downloads-This section provide great applications to download.

5) Resources- This section provide the links to resources that a developer might require.

6) Forums- A great forums for windows application developer.

For more details go to the following link:

http://www.windowsforms.net/
Share:
Wednesday, January 10, 2007

.NET Framework Release

The .NET Framework 3.0 has been launched with windows vista and 64 bit support. You can download the .NET Framework 3.0 components here:
.NET Framework 3.0 Runtime Components
Windows SDK for Vista and the .NET Framework 3.0
Visual Studio 2005 Extensions for .NET Framework 3.0 (Windows Workflow Foundation)
Visual Studio 2005 Extensions for .NET Framework 3.0 (WCF & WPF), November 2006 CTP

Note, if you are using Windows Vista the .NET Framework 3.0 Framework is directly installed when you install the operating system.
Share:
Thursday, August 10, 2006

Paging in Datalist or Repeater Control In ASP.NET

==============================================
HTML of Datalist
==============================================
<asp:datalist id="dsList" runat="server" width=100%>

<ItemTemplate>

<%#DataBinder.Eval(Container.DataItem, "ID").ToString()%>

<%#DataBinder.Eval(Container.DataItem, "Name").ToString()%>

</ItemTemplate>

</asp:datalist>



<table width="100%" border="0" align="Center">

<tr>

<td><asp:LinkButton id="lnkPrevious" runat="server">

</asp:LinkButton>

</td>

<td><asp:LinkButton id="lnkNext" runat="server">>

</asp:LinkButton>

</td>

</tr>

</table>
===============================================
Server Side Coding : VB.NET
===============================================

Dim Start As Integer
Dim dbCon As SqlConnection
Dim Adpt As SqlDataAdapter
Dim dtUser As DataSet

Private Sub Page_Load(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles MyBase.Load

If Not Page.IsPostBack Then
ViewState("Start") = 0
BindData()
End If


End Sub

Sub BindData()

dbCon = New SqlConnection("server=localhost;uid=sa;
pwd=;database=user")
Adpt = New SqlDataAdapter("Select * from user ", dbCon)
dtUser = New DataSet
Start = ViewState("Start")
ViewState("Size") = 14
Adpt.Fill(dtUser, Start, ViewState("Size"), "user")
dsList.DataSource = dtUser
dsList.DataBind()

End Sub



Private Sub lnkPrevious_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles lnkPrevious.Click

Start = ViewState("Start")- ViewState("Size")
ViewState("Start") = Start
If Start <= 0 Then ViewState("Start") = 0 End If BindData() End Sub Private Sub lnkNext_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lnkNext.Click Dim count As Integer = dsList.Items.Count Start = ViewState("Start") + ViewState("Size") ViewState("Start") = Start If count <>
=====================================================
Server Side Coding: c#
=====================================================
int Start ;
SqlConnection dbCon ;
SqlDataAdapter Adpt ;
DataSet dtUser ;
private void Page_Load(object sender, System.EventArgs e)
{
if(!Page.IsPostBack )
{
ViewState["Start"] = 0;
BindData();
}
}
void BindData()
{
dbCon = new SqlConnection("server=localhost;uid=sa;
pwd=;database=user");
Adpt = new SqlDataAdapter("Select * from user", dbCon);
dtUser = new DataSet();
Start = (int)ViewState["Start"];
ViewState["Size"] = 14;
Adpt.Fill(dtUser, Start,(int) ViewState["Size"], "user");
dsList.DataSource = dtUser;
dsList.DataBind();
}

private void lnkPrevious_Click(object sender, System.EventArgs e)
{
Start = (int) ViewState["Start"] -(int) ViewState["Size"];
ViewState["Start"] = Start;
if (Start <= 0 ) { ViewState["Start"] = 0; } BindData(); } private void lnkNext_Click(object sender, System.EventArgs e) { int count = dsList.Items.Count; Start = (int) ViewState["Start"]+(int) ViewState["Size"]; ViewState["Start"] = Start; if ( count < (int)ViewState["Size"] ) { ViewState["Start"] = (int)ViewState["Start"] - (int)ViewState["Size"]; } BindData(); }
Share:
Tuesday, August 1, 2006

Use Component Class in Business Logic Class in C# or VB.NET:

You can get many advantage using a component class instead
of simple class.

Following are the some basic advantage that you can get using
component class.

- It implements System.Component namespace
- You can drag and drop any existing data access component.So
you have to right less code.
- You can drag and drop stored procedure and other sql server
object and .NET IDE will create sqlcommand and adapter and
command object directly.
- You can use typed dataset with the component class easily
without writing any code through wizards.
Share:
Wednesday, July 12, 2006

Refactor tool in visual studio 2005

Re factor tool in the visual studio 2005

Visual studion provides great tool for modifying or make it simple. The Refactor tool
provides great functionality like changing parameters sequence or rename parameters,
record parameters,extract methods.

All this things can be done within the minutes. For c# go to in your code right
click and you can choose one of option that you want to do with your code.

Refractor for Visual Basic 2005:
=======================
Refactor! for Visual Basic 2005 is a free plug-in from Developer Express Inc.,
in partnership with Microsoft, that enables Visual Basic developers to simplify
and re-structure source code inside of Visual Studio 2005, making it easier to
read and less costly to maintain. Refactor! supports more than 15 individual
refactoring features, including operations like Reorder Parameters, Extract Method,
Encapsulate Field and Create Overload.

Download from this url:
http://msdn.microsoft.com/vbasic/downloads/tools/refactor/

For more details please visit:
http://sa-action.spaces.msn.com
Share:

Custom Membership and Role Provider In ASP.NET

Put this into web.config file for removing default connection string

&lt;connectionStrings>

&lt;remove name="LocalSqlServer"/>

&lt;add name="xyzConnectionString"

connectionString="Data Source=vsdotnet;

Initial Catalog=xyz;User Id=sa;Password=sa;"

providerName="System.Data.SqlClient"/>

&lt;/connectionStrings>

Put this in web.config file for membership providers.


&lt;membership>

&lt;providers>

&lt;remove name="AspNetSqlMembershipProvider"/>

&lt;add connectionStringName="xyzConnectionString"

enablePasswordRetrieval="false"

enablePasswordReset="true"

requiresQuestionAndAnswer="true"

applicationName="/"

requiresUniqueEmail="false"

passwordFormat="Hashed"

maxInvalidPasswordAttempts="4"

minRequiredPasswordLength="7"

minRequiredNonalphanumericCharacters="1"

passwordAttemptWindow="10"

passwordStrengthRegularExpression=""

name="AspNetSqlMembershipProvider"

type="System.Web.Security.SqlMembershipProvider,

System.Web, Version=2.0.0.0, Culture=neutral,

PublicKeyToken=b03f5f7f11d50a3a"/>

&lt;/providers>

&lt;/membership>


put this into web.config files for role provider


&lt;roleManager enabled="true">

&lt;providers>

&lt;remove name="AspNetSqlRoleProvider"/>

&lt;add connectionStringName="xyzConnectionString"

applicationName="/" name="AspNetSqlRoleProvider"

type="System.Web.Security.SqlRoleProvider, System.Web,

Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>

&lt;remove name="AspNetWindowsTokenRoleProvider"/>

&lt;/providers>

&lt;/roleManager>

Share:
Saturday, July 1, 2006

what is serialization -deserialization

Serialization is the process of storing class object into the some other
state may be a file or file or something like else.

Object Serialization is the process of reducing the objects instance into
a format that can either be stored to disk or transported over a Network.

Later time the Object will changed into its original state with the
re server process of deserialization.

Microsoft.NET support both serialization and deserialization.

Happy Programming..
Share:
Thursday, June 29, 2006
Wednesday, June 28, 2006

Learn Visual Studio.NET 2005 with express edition

You can learn Microsoft.NET with the express edition sql server 2005 database and visual studio Ide expression edition. It is free and available for the down load. It provide almost
functionality as professional IDE.

To download SQL Server 2005 Express Edition:

http://msdn.microsoft.com/vstudio/express/sql/default.aspx

To download VB.NET 2005 Express Edition:

http://msdn.microsoft.com/vstudio/express/vb/

To Download C# express edition

http://msdn.microsoft.com/vstudio/express/visualcsharp/

So go start .NET Programming now.. Happy Programming
Share:

General Error Class for ASP.NET

#Region "NameSpace"

Imports System

#End Region

Namespace Abc.Error

Public Class CustomError

#Region "Declartion"

Private Shared _errorno As Integer

Private Shared _errorname As Integer

Private Shared _errordescription As String

Private Shared _errorsource As String

#End Region

#Region "Properties"

Public Shared Property ErroNo() As Integer

Get

ErroNo = _errorno

End Get

Set(ByVal Value As Integer)

_errorno = Value

End Set

End Property

Public Shared Property ErrorName() As String

Get

ErrorName = _errorname

End Get

Set(ByVal Value As String)

_errorname = Value

End Set

End Property

Public Shared Property ErrorDescription() As String

Get

ErrorDescription = _errordescription

End Get

Set(ByVal Value As String)

_errordescription = Value

End Set

End Property

Public Shared Property ErrorSource() As String

Get

ErrorSource = _errorsource

End Get

Set(ByVal Value As String)

_errorsource = Value

End Set

End Property




#End Region

#Region "Constructors"

#End Region


#Region "Methods"

#End Region
Share:
Tuesday, June 27, 2006

How to disable right click in Ms WebBrowser Control of VB/C#.NET 2005

I have researched a lot about disabling the right click in web browser control for C# and VB.NET 2005 lot but i have found a simple solution.

It has a property called IsWebBrowserContextMenuEnabled just set it to False. It will disable the right click in web browser control.

Isn't that easy. Stay tuned for more!!
Share:

Support this blog-Buy me a coffee

Buy me a coffeeBuy me a coffee
Search This Blog
Subscribe to my blog

  

My Mvp Profile
Follow us on facebook
Blog Archive
Total Pageviews