Windows Phone Developers

Tuesday, January 22, 2008

Manage Local Data Files in Projects



A local database file can be included as a file in a project. The first time you connect your application to a local database file, you can choose between creating a copy of the database in your project or connecting to the existing database file in its current location. For more information, see Local Data Overview.




If you choose to connect to the existing file, then a connection is created just as if you were connecting to any remote database, and the database file is left in its original location.

If you choose to copy the database into your project, Visual Studio creates a copy of the database file, adds it to your project, and modifies the connection so that it now points to the database in your project.


Note

Existing data connections in Server Explorer are modified to point to the database file in the project as well (the database file in the project's root folder).

By default, when you build a project, the database file is copied from the root project folder into the output (bin) folder (select Show All Files in Solution Explorer to view the bin folder). This behavior is due to the Copy to Output Directory property of the file. The default setting of the Copy to Output Directory property is Copy always. This means that the database in the bin folder will be copied every time you build, debug, or run your application (that is, copied from the root project folder to the output directory).

NoteNote

The behavior of the Copy to Output Directory property does not apply to web or C++ projects.

The database file in your root project folder is only changed when you edit the database schema or data using Server Explorer/Database Explorer or other Visual Database Tools.

The relationship between the two versions of your database file is dependent on the setting of the Copy to Output Directory property, which is described in the table below.

During application development, any changes made to the data (during run time within your application) are being made to the database in the bin folder. For example, when you press F5 to debug your application, you are connected to the database in the bin folder.

Copy to Output Directory setting

Behavior

Copy if newer

This option is not recommended. The database file is copied from the project directory to the bin directory the first time the project is built. Every subsequent time you build the project, the Date Modified property of the files is compared. If the file in the project folder is newer, it is copied to the bin folder, replacing the file currently there. If the file in the bin folder is newer, then no files are copied. This setting persists any changes made to the data during run time, meaning every time you run your application and save changes to the data, those changes are visible the next time you run your application.

Caution noteCaution

The database file can change even when no changes are made to the data. Simply opening a connection (for example, expanding the Tables node in Server Explorer) on a data file can mark it as newer. Because of this unpredictable behavior, we recommended that you do not use this option.

Copy always (default)

The database file is copied from the project directory to the bin directory every time you build your application. Every time you build your application and save changes to the data, those changes are overwritten when the original file is copied to the bin directory, replacing the copy that you just changed. You do not see the updated data the next time you run your application. Any changes made to the data file in the output folder will be overwritten the next time you run the application.

Do not copy

The file is never copied or overwritten by the project system. Because your application creates a dynamic connection string that points to the database file in the output directory, this setting only works for local database files when you manually copy the file yourself. You must manually copy the file to the output directory after setting to Do not copy.

Procedure

To respond to the Local database file dialog box

· Click Yes if you want Visual Studio to copy the database file into your project and modify the connection to point to the copy in your project. For more information on working with database files in your project, see Local Data Overview.

· Click No if you do not want Visual Studio to copy the database file into your project. Instead, the connection points to the file in the original location.


Digg Technorati Delicious StumbleUpon Reddit BlinkList Furl Mixx Facebook Google Bookmark Yahoo
ma.gnolia squidoo newsvine live netscape tailrank mister-wong blogmarks slashdot spurl StumbleUpon

What is a static class?

What is a static class?

Static classes are classes that do not contain instance members other than those inherited from Object, and do not have a callable constructor.

 
The members of a static class are accessed directly without an instance of the class.

Example

Console.WriteLine ("I Do not need any instances")

Environment.CommandLine

Digg Technorati Delicious StumbleUpon Reddit BlinkList Furl Mixx Facebook Google Bookmark Yahoo
ma.gnolia squidoo newsvine live netscape tailrank mister-wong blogmarks slashdot spurl StumbleUpon

Thursday, December 27, 2007

Download Visual Studio 2008 and the .NET Framework 3.5

Microsoft announced that Visual Studio 2008 and the .NET Framework 3.5 were released to manufacturing (RTM). With more than 250 new features,Visual Studio 2008 includes significant enhancements in every edition, including Visual Studio Express and Visual Studio Team System. Developers of all levels – from hobbyists to enterprise development teams – now have a consistent, secure and reliable solution for developing applications for the latest platforms: the Web, Windows Vista, Windows Server 2008, the 2007 Office system, and beyond. Learn more about Visual Studio 2008.All of the above happening @ http://msdn2.microsoft.com/en-us/vstudio/default.aspx Digg Technorati Delicious StumbleUpon Reddit BlinkList Furl Mixx Facebook Google Bookmark Yahoo
ma.gnolia squidoo newsvine live netscape tailrank mister-wong blogmarks slashdot spurl StumbleUpon

Sunday, December 23, 2007

Split Function in Visual Basic .Net

Split Function returns a zero-based, one-dimensional array containing a specified number of substrings.

Function DND_Split_Example()

Dim arTempVB2005() As String

Dim arTempVB6() As String

Dim arTempSpace() As String

Dim sSplitString As String

sSplitString = "MyName||MyAge||MySex"

arTempVB2005 = sSplitString.Split("||")

arTempVB6 = Microsoft.VisualBasic.Split(sSplitString, "||")

arTempSpace = Split("Split By Spaces”)

End Function





Here are the overloaded examples of Split Function


Split Call

Return Value

Split("42, 12, 19")

{"42," , "12," , "19"}

Split("42, 12, 19", ", ")

{"42", "12", "19"}

Split("42, 12, 19", ", ", 2)

{"42", "12, 19"}

Split("192.168.0.1", ".")

{"192", "168", "0", "1"}

Split("Alice and Bob", " AND ")

{"Alice and Bob"}

Split("Alice and Bob", " AND ", ,CompareMethod.Text)

{"Alice", "Bob"}

Split("someone@example.com", "@",1)

{"someone@example.com"}

Split("someone@example.com", "@",2)

{"someone", "example.com"}



Digg Technorati Delicious StumbleUpon Reddit BlinkList Furl Mixx Facebook Google Bookmark Yahoo
ma.gnolia squidoo newsvine live netscape tailrank mister-wong blogmarks slashdot spurl StumbleUpon

Visual Studio Immediate Window

Immediate and Command window in Visual Studio

The Command window is used to execute commands or aliases directly in the Visual Studio integrated development environment (IDE). You can execute both menu commands and commands that do not appear on any menu. To display the Command window, choose Other Windows from the View menu, and select Command Window

The Immediate window is used to debug and evaluate expressions, execute statements, print variable values, and so forth. It allows you to enter expressions to be evaluated or executed by the development language during debugging. To display the Immediate window, open a project for editing, then choose Windows from the Debug menu and select Immediate.

You can use this window to issue individual Visual Studio commands. The available commands include EvaluateStatement, which can be used to assign values to variables. The Immediate window also supports IntelliSense.




The table below contains a list of the pre-defined aliases that come with Visual Studio 2005

Command Name

Alias

Complete Name

Print

?

Debug.Print

Quick Watch

??

Debug.Quickwatch

Add New Project

AddProj

File.AddNewProject

Alias

Alias

Tools.Alias

Autos window

Autos

Debug.Autos

Breakpoints window

bl

Debug.Breakpoints

Toggle Breakpoint

bp

Debug.ToggleBreakPoint

Call Stack window

CallStack

Debug.CallStack

Clear Bookmarks

ClearBook

Edit.ClearBookmarks

Close

Close

File.Close

Close All Documents

CloseAll

Window.CloseAllDocuments

Clear All

cls

Edit.ClearAll

Command mode

cmd

View.CommandWindow

View Code

code

View.ViewCode

List Memory

d

Debug.ListMemory

List Memory as ANSI

da

Debug.ListMemory /Ansi

List Memory One Byte format

db

Debug.ListMemory /Format:OneByte

List Memory as ANSI with Four Byte format

dc

Debug.ListMemory /Format:FourBytes /Ansi

List Memory Four Byte format

dd

Debug.ListMemory /Format:FourBytes

Delete to BOL

DelBOL

Edit.DeleteToBOL

Delete to EOL

DelEOL

Edit.DeleteToEOL

Delete Horizontal Whitespace

DelHSp

Edit.DeleteHorizontalWhitespace

View Designer

designer

View.ViewDesigner

List Memory Float format

df

Debug.ListMemory/Format:Float

Disassembly window

disasm

Debug.Disassembly

List Memory Eight Byte format

dq

Debug.ListMemory /Format:EightBytes

List Memory as Unicode

du

Debug.ListMemory /Unicode

Evaluate Statement

eval

Debug.EvaluateStatement

Exit

Exit

File.Exit

Format Selection

format

Edit.FormatSelection

Full Screen

FullScreen

View.FullScreen

Start

g

Debug.Start

Go To

GotoLn

Edit.GoTo

Go to Brace

GotoBrace

Edit.GotoBrace

F1Help

Help

Help.F1Help

Immediate Mode

immed

Tools.ImmediateMode

Insert File as Text

InsertFile

Edit.InsertFileAsText

List Call Stack

kb

Debug.ListCallStack

Make Lower Case

Lcase

Edit.MakeLowercase

Cut Line

LineCut

Edit.LineCut

Delete Line

LineDel

Edit.LineDelete

List Members

ListMembers

Edit.ListMembers

Locals window

Locals

Debug.Locals

Log Command Window Output

Log

Tools.LogCommandWindowOutput

Command Window Mark Mode

mark

Tools.CommandWindowMarkMode

Memory window

Memory Memory1

Debug.Memory1

Memory Window 2

Memory2

Debug.Memory2

Memory Window 3

Memory3

Debug.Memory3

Memory Window 4

Memory4

Debug.Memory4

Set Radix

n

Debug.SetRadix

ShowWebBrowser

nav navigate

View.ShowWebBrowser

Next Bookmark

NextBook

Edit.NextBookmark

New File

nf

File.NewFile

New Project

np NewProj

File.NewProject

Open File

of Open

File.OpenFile

Open Project

op

File.OpenProject

Collapse to Definitions/Stop Outlining

OutlineDefs StopOutlining

Edit.CollapsetoDefinitions

Step Over

p

Debug.StepOver

Parameter Information

ParamInfo

Edit.ParameterInfo

Step Out

pr

Debug.StepOut

Previous Bookmark

PrevBook

Edit.PreviousBookmark

Print File

print

File.Print

Properties Window

props

View.PropertiesWindow

Stop

q

Debug.StopDebugging

Redo

redo

Edit.Redo

Registers window

registers

Debug.Registers

Run to Cursor

rtc

Debug.RunToCursor

Save Selected Items

save

File.SaveSelectedItems

Save All

SaveAll

File.SaveAll

Save As

SaveAs

File.SaveSelectedItemsAs

Script Only View

ScriptOnly

View.ShowScriptOnly

Shell

shell

Tools.Shell

Stop Find In Files

StopFind

Edit.FindInFiles /stop

Swap Anchor

SwapAnchor

Edit.SwapAnchor

Step Into

t

Debug.StepInto

Tabify Selection

tabify

Edit.TabifySelection

Tasklist window

TaskList

View.TaskList

Threads window

Threads

Debug.Threads

Tile Horizontally

TileH

Window.TileHorizontally

Tile Vertically

TileV

Window.TileVertically

Toggle Bookmark

ToggleBook

Edit.ToggleBookmark

Toolbox window

toolbox

View.Toolbox

List Disassembly

u

Debug.ListDisassembly

Make Uppercase

Ucase

Edit.MakeUppercase

Undo

undo

Edit.Undo

Untabify Selection

Untabify

Edit.UntabifySelection

Watch window

Watch

Debug.WatchN

Toggle Word Wrap

WordWrap

Edit.ToggleWordWrap

List Threads

~

Debug.ListThreads

Digg Technorati Delicious StumbleUpon Reddit BlinkList Furl Mixx Facebook Google Bookmark Yahoo
ma.gnolia squidoo newsvine live netscape tailrank mister-wong blogmarks slashdot spurl StumbleUpon

Microsoft XP Style Buttons and Controls on Form in .Net

Change style of Buttons to Microsoft XP Standard using .Net

Visual style is the user-modifiable appearance of the user interface of an application or operating system. By default, Windows XP provides a new visual style. The scroll bars and title bar of a Windows Form will automatically use the new visual style when the form is run on Windows XP. If your application calls the EnableVisualStyles method, most of your Windows Forms controls will automatically use the visual style when your application is run on Windows XP

Private Sub frmDND1Main_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

Application.EnableVisualStyles()

End Sub

The same can be achieved in the designer :


Digg Technorati Delicious StumbleUpon Reddit BlinkList Furl Mixx Facebook Google Bookmark Yahoo
ma.gnolia squidoo newsvine live netscape tailrank mister-wong blogmarks slashdot spurl StumbleUpon

Preventing multiple instances of .Net Application

Single instance application in VB.Net

If you were creating a Windows application, most often you would be doing some database initialization or some network validation before you show up the form to the user.

The patient user might wait few seconds to let the form show, others might launch the application again. To avoid user launch multiple instances of the application, select the Make single instance application check box to prevent users from running multiple instances of your application. The default setting for this check box is cleared, allowing multiple instances of the application to be run.

You can do this from ProjectàPropertiesàApplication tab







Digg Technorati Delicious StumbleUpon Reddit BlinkList Furl Mixx Facebook Google Bookmark Yahoo
ma.gnolia squidoo newsvine live netscape tailrank mister-wong blogmarks slashdot spurl StumbleUpon