http://msdn.microsoft.com/en-us/library/ms173195.aspx
This list is not an exhaustive list of potential security problems. It highlights some common issues for C# developers.
http://msdn.microsoft.com/en-us/library/ms173195.aspx
This list is not an exhaustive list of potential security problems. It highlights some common issues for C# developers.
http://msdn.microsoft.com/en-us/library/aa192483(office.11).aspx
Word.Table tbl = ThisDocument.Tables[1];
tbl.Range.Font.Size = 8;
tbl.Range.Font.Name = “Verdana”;
Object style = “Table Grid 8”;
tbl.set_Style(ref style);
tbl.ApplyStyleFirstColumn = false;
tbl.ApplyStyleLastColumn = false;
tbl.ApplyStyleLastRow = false;
// Insert header text and format the columns.
tbl.Cell(1, 1).Range.Text = “Name”;
Word.Range rngCell;
rngCell = tbl.Cell(1, 2).Range;
rngCell.Text = “Size”;
rngCell.ParagraphFormat.Alignment =
Word.WdParagraphAlignment.wdAlignParagraphRight;
rngCell = tbl.Cell(1, 3).Range;
rngCell.Text = “Modified”;
rngCell.ParagraphFormat.Alignment =
Word.WdParagraphAlignment.wdAlignParagraphRight;
7. Embedding a Document:
Embedding a document is done through the application by
Insert-> Object-> Create from file-> Select the File-> Display as Icon. This embeds the file in the selected location as an icon and the user can double click on the icon to open the file. The same can be done through automation.
The range supposed to set at the required place and the same has to be selected (range can be set by any of the means mentioned above). Now with the selection, the file can be embedded.
//ICON LABEL CAN BE THE NAME OF THE FILE,
//ITS THE NAME DISPLAYED BESIDES THE EMBEDDED DOCUMENT
Object oIconLabel = “File Name”;
//INCASE WE NEED THE EMBEDDED DOCUMENT TO BE DISPLAYED AS A SPECIFIC ICON,
//WE NEED TO SPECIFY THE LOCATION OF THE ICON FILE
//ELSE SET IT TO oMissing VALUE
Object oIconFileName = “C:\\Document and Settings\\IconFile.ico”;
//THE BOOKMARK WHERE THE FILE NEEDS TO BE EMBEDDED
Object oBookMark = “My_Custom_BookMark”;
//THE LOCATION OF THE FILE
Object oFileDesignInfo = “C:\\Document and Settings\\somefile.doc”;
//OTHER VARIABLES
Object oClassType = “Word.Document.8”;
Object oTrue = true;
Object oFalse = false;
Object oMissing = System.Reflection.Missing.Value;
//METHOD TO EMBED THE DOCUMENT
oWordDoc.Bookmarks.get_Item(ref oBookMark).Range.InlineShapes.AddOLEObject(
ref oClassType,ref oFileDesignInfo,ref oFalse, ref oTrue, ref oIconFileName,
ref oMissing,ref oIconLabel, ref oMissing);
http://www.codeproject.com/KB/cs/Three_Layer_Architecture.aspx
Here in this article, I would like to cover the typical three layer architecture in C# .NET. It is a very useful approach for coding due to easy code maintenance.
First let me give you a small overview about the topic I would like to cover in this article.
1.1 Tier: Tier indicates a physical separation of components, which may mean different assemblies such as DLL, EXE, etc. on the same server or multiple servers.
As you can see in the above figure, Data Tier have no direction with Presentation Tier, but there is an intermediate Tier called Business Tier which is mainly responsible to pass the data from Data Tier to Presentation Tier and to add defined business logic to Data.
So, if we separate each Tier by its functionality, then we come to know the below conclusion:
1.2 Layer: Layer indicates logical separation of components, such as having distinct namespaces and classes for the Database Access Layer, Business Logic Layer and User Interface Layer.
As we have already seen, tier is the sum of all the physical components. We can separate the three tiers as Data Tier, Business Tier and Presentation Tier.
The above figure is a mixture of Three Tier and Three Layer Architecture. Here, we can clearly see a different between Tier and Layer. Since each component is independent of each other, they are easily maintainable without changing the whole code.
This approach is really very important when several developers are working on the same project and some module needs to be re-used in another project. In a way, we can distribute work among developers and also maintain it in the future without much problems.
Testing is also a very important issue for Architecture when we are considering writing a test case for the project. Since it’s like a modular architecture, it’s very handy testing each module and to trace out bugs without going through the entire code.
Let’s go though from one module to other to have a better understanding of it.
This class is mainly used to do the database activity like Select, Update and Delete query to database. It also checks if the database connection is open or not. If database connection is not open, then it opens the connection and performs the database query. The database results are to be received and being passing in Data Table in this class.
This class takes the database setting from the app.config file so it’s really flexible to manage the database settings.
using System; using System.Collections.Generic; using System.Text; using System.Data; using System.Data.SqlClient; using System.Configuration; namespace ThreeLayerDemo.Core { public class dbConnection { private SqlDataAdapter myAdapter; private SqlConnection conn; /// <constructor> /// Initialise Connection /// </constructor> public dbConnection() { myAdapter = new SqlDataAdapter(); conn = new SqlConnection(ConfigurationManager.ConnectionStrings ["dbConnectionString"].ConnectionString); } /// <method> /// Open Database Connection if Closed or Broken /// </method> private SqlConnection openConnection() { if (conn.State == ConnectionState.Closed || conn.State == ConnectionState.Broken) { conn.Open(); } return conn; } /// <method> /// Select Query /// </method> public DataTable executeSelectQuery(String _query, SqlParameter[] sqlParameter) { SqlCommand myCommand = new SqlCommand(); DataTable dataTable = new DataTable(); dataTable = null; DataSet ds = new DataSet(); try { myCommand.Connection = openConnection(); myCommand.CommandText = _query; myCommand.Parameters.AddRange(sqlParameter); myCommand.ExecuteNonQuery(); myAdapter.SelectCommand = myCommand; myAdapter.Fill(ds); dataTable = ds.Tables[0]; } catch (SqlException e) { Console.Write("Error - Connection.executeSelectQuery - Query: " + _query + " \nException: " + e.StackTrace.ToString()); return null; } finally { } return dataTable; } /// <method> /// Insert Query /// </method> public bool executeInsertQuery(String _query, SqlParameter[] sqlParameter) { SqlCommand myCommand = new SqlCommand(); try { myCommand.Connection = openConnection(); myCommand.CommandText = _query; myCommand.Parameters.AddRange(sqlParameter); myAdapter.InsertCommand = myCommand; myCommand.ExecuteNonQuery(); } catch (SqlException e) { Console.Write("Error - Connection.executeInsertQuery - Query: " + _query + " \nException: \n" + e.StackTrace.ToString()); return false; } finally { } return true; } /// <method> /// Update Query /// </method> public bool executeUpdateQuery(String _query, SqlParameter[] sqlParameter) { SqlCommand myCommand = new SqlCommand(); try { myCommand.Connection = openConnection(); myCommand.CommandText = _query; myCommand.Parameters.AddRange(sqlParameter); myAdapter.UpdateCommand = myCommand; myCommand.ExecuteNonQuery(); } catch (SqlException e) { Console.Write("Error - Connection.executeUpdateQuery - Query: " + _query + " \nException: " + e.StackTrace.ToString()); return false; } finally { } return true; } } }
Database Access Layer (DAO) builds the query based on received parameters from the Business Logic Layer and passes it the dbConnection
class for execution. And simple return results from the dbConnection
class to Business Logic Layer.
using System; using System.Collections.Generic; using System.Text; using System.Data; using System.Data.SqlClient; namespace ThreeLayerDemo.Core { public class UserDAO { private dbConnection conn; /// <constructor> /// Constructor UserDAO /// </constructor> public UserDAO() { conn = new dbConnection(); } /// <method> /// Get User Email By Firstname or Lastname and return DataTable /// </method> public DataTable searchByName(string _username) { string query = string.Format("select * from [t01_user] where t01_firstname like @t01_firstname or t01_lastname like @t01_lastname "); SqlParameter[] sqlParameters = new SqlParameter[2]; sqlParameters[0] = new SqlParameter("@t01_firstname", SqlDbType.VarChar); sqlParameters[0].Value = Convert.ToString(_username); sqlParameters[1] = new SqlParameter("@t01_lastname", SqlDbType.VarChar); sqlParameters[1].Value = Convert.ToString(_username); return conn.executeSelectQuery(query, sqlParameters); } /// <method> /// Get User Email By Id and return DataTable /// </method> public DataTable searchById(string _id) { string query = "select * from [t01_id] where t01_id = @t01_id"; SqlParameter[] sqlParameters = new SqlParameter[1]; sqlParameters[0] = new SqlParameter("@t01_id", SqlDbType.VarChar); sqlParameters[0].Value = Convert.ToString(_id); return conn.executeSelectQuery(query, sqlParameters); } } }
Value Object is nothing more but a class with the contents GET
and SET
methods. It’s mainly used to pass Data from one class to another. It’s directly connected with Business Logic Layer and Presentation Layer. As you can see in the diagram object values are being SET in Business Logic Layer and GET from Presentation Layer.
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace ThreeLayerDemo.Core { public class UserVO { private int _idUser; private string _firstname; private string _lastname; private string _email; /// <constructor> /// Constructor UserVO /// </constructor> public UserVO() { // // TODO: Add constructor logic here // } public int idUser { get { return _idUser; } set { _idUser = value; } } public string firstname { get { return _firstname; } set { _firstname = value; } } public string lastname { get { return _lastname; } set { _lastname = value; } } public string email { get { return _email; } set { _email = value; } } } }
Business Logic Layer (BUS) works as a bridge between Presentation Layer and DAO. All the user values received from the presentation layer are being passed to BUS. The results received from the DAO are in row data in Data Table format but in BUS it’s converting into Value Objects (VO). Business Logic Layer (BUS) is the most important class in the whole architecture because it mainly contains all the business logic of the program. Whenever a user wants to update the business logic of the program only need to update this class.
using System; using System.Collections.Generic; using System.Text; using System.Data; namespace ThreeLayerDemo.Core { /// <summary> /// Summary description for UserBUS /// </summary> public class UserBUS { private UserDAO _userDAO; /// <constructor> /// Constructor UserBUS /// </constructor> public UserBUS() { _userDAO = new UserDAO(); } /// <method> /// Get User Email By Firstname or Lastname and return VO /// </method> public UserVO getUserEmailByName(string name) { UserVO userVO = new UserVO(); DataTable dataTable = new DataTable(); dataTable = _userDAO.searchByName(name); foreach (DataRow dr in dataTable.Rows) { userVO.idUser = Int32.Parse(dr["t01_id"].ToString()); userVO.firstname = dr["t01_firstname"].ToString(); userVO.lastname = dr["t01_lastname"].ToString(); userVO.email = dr["t01_email"].ToString(); } return userVO; } /// <method> /// Get User Email By Id and return DataTable /// </method> public UserVO getUserById(string _id) { UserVO userVO = new UserVO(); DataTable dataTable = new DataTable(); dataTable = _userDAO.searchById(_id); foreach (DataRow dr in dataTable.Rows) { userVO.idUser = Int32.Parse(dr["t01_id"].ToString()); userVO.firstname = dr["t01_firstname"].ToString(); userVO.lastname = dr["t01_lastname"].ToString(); userVO.email = dr["t01_email"].ToString(); } return userVO; } } }
Presentation Layer is the only layer which is directly connected with the user. So in this matter, it’s also a really important layer for marketing purposes. Presentation Layer is mainly used for getting user data and then passing it to Business Logic Layer for further procedure, and when data is received in Value Object then it’s responsible to represent value object in the appropriate form which user can understand.
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using ThreeLayerDemo.Core; namespace ThreeLayerDemo { public partial class frmLogin : Form { private UserBUS _userBUS; public frmLogin() { InitializeComponent(); _userBUS = new UserBUS(); } private void btnSearch_Click(object sender, EventArgs e) { UserVO _userVO = new UserVO(); _userVO = _userBUS.getUserEmailByName(txtUsername.Text); if (_userVO.email == null) MessageBox.Show("No Match Found!", "Not Found", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); else MessageBox.Show(_userVO.email ,"Result", MessageBoxButtons.OK,MessageBoxIcon.Information); } private void btnCancel_Click(object sender, EventArgs e) { Close(); } } }
Hope this explanation helps the beginner specially looking for a generic approach. There are also some methods which are far better than the architecture described above, mostly with skipping Database Access Layer and Value Object Class, and making it dynamically which is really handy for maintenance in case of frequent database change. I will try to post some in the near future.
Shortcut | Description |
Ctrl-X or Shift-Delete |
Cắt mục được lụa chọn |
Ctrl-C or Ctrl-Insert |
Copy mục được lụa chọn |
Ctrl-V or Shift-Insert |
Dán |
Ctrl-Z or Alt-Backspace |
Quay lại một bước |
Ctrl-Y or Ctrl-Shift-Z |
Ngược lại với hành động trên |
Esc |
Đóng một menu, hủy bỏ một thao tác trong cửa sổ hiện thời. |
Ctrl-S |
Lưu một file hoặc một cửa sổ trong dự án mà bạn đang làm ( thông thường là cửa sổ bạn đang làm việc) |
Ctrl-Shift-S |
Lưu tất cả các tài liệu trong dự án |
Ctrl-P |
In tài mà bạn đang trình bày |
F7 |
Chuyển từ design view sang code view |
Shift-F7 |
Chuyển từ Code view sang Design view |
F8 |
Di chuyển con trỏ sang mục tiếp theo, nó được sử dụng trong cửa sổ TaskList hoặc trong cửa sổ tìm kiếm |
Shift-F8 |
Di chuyển con trỏ sang trước đó, nó được sử dụng trong cửa sổ TaskList hoặc trong cửa sổ tìm kiếm |
Shift-F12 |
Tìm một reference tới mục đang được chọn hoặc mục tại vị trí con trỏ |
Ctrl-Shift-G |
Mở file với tên đang được chọn tại vị trí con trỏ |
Ctrl-/ |
Chuyển hướng đến hộp lệnh tìm kiếm trên thanh Standard |
Ctrl-Shift-F12 |
Chuyển tới nhiệm vụ tiếp theo trong cửa sổ TaskList |
Ctrl-Shift-8 |
Quay trở lại trong Browse History – Sẵn có trong đối tượng trình duyệt hoặc cửa sổ Class View. |
Alt-Left Arrow |
Quay trở lại trong khi duyệt Web |
Alt-Right Arrow |
Ngược lại với hành động trên, quay lại bước trước đó trong khi duyệt Web |
Shortcut | Description |
Left Arrow |
Di chuyển con trỏ sang trái 1 ký tự |
Right Arrow |
Di chuyển con trỏ sang phải 1 ký tự |
Down Arrow |
Dịch chuyển con trỏ xuống một dòng |
Up Arrow |
Dịch chuyển con trỏ lên một dòng |
Page Down |
Cuộn xuống một màn hình trong cửa sổ soạn thảo |
Page Up |
Ngược lại với bước trên – cuộn lên một màn hình trong cửa sổ soạn thảo. |
End |
Dịch chuyển con trỏ đến cuối dòng hiện tại |
Home |
Dịch chuyển con trỏ đến đầu dòng, trước một kí tự. Nếu bạn nhấn phím “Home” khi con trỏ đang ở vị trí đầu tiên của một dòng, con trỏ sẽ bị gắn chặt vào đầu dòng thực sự, dù sau nó là một khoảng trống rồi mới đến đoạn văn bản. |
Ctrl-End |
Dịch chuyển con trỏ đến cuối một tài liệu |
Ctrl-Home |
Dịch chuyển con trỏ đến vị trí bắt đầucủa tài liệu |
Ctrl-G |
Hiển thị hộp thoại “Go To Line” – “Chuyển đến dòng”, Nếu đang trong quá trình Debug, Hộp thoại sẽ cho phép bạn xác thực địa chỉ hay là tên của một hàm |
Ctrl-] |
Dịch chuyển con trỏ qua lại giữa vị trí của một cặp dấu ngoặc. Nếu con trỏ đang đứng ở vị trí của ngoặc “Mở”, khi nhấn cặp phím tắt này con trỏ sẽ dịch chuyển đến ngay vị trí của ngoặc “Đóng” và ngược lại |
Ctrl-K, Ctrl-N |
Dịch chuyển đến điểm ghi nhớ (BookMark) tiếp theo trong tài liệu |
Ctrl-K, Ctrl-P |
Chuyển đến điểm ghi nhớ trước |
Ctrl-K, Ctrl-I |
Hiển thị thông tin nhanh, dựa trên ngôn ngữ hiện tại |
Ctrl-Down Arrow |
Cuộn xuống một dòng văn bản nhưng lại không làm dịch chuyển vị trí của con trỏ. Điều này rất thuận lợi cho việc kiểm tra các dòng lệnh khác mà không làm mất dấu vị trí của con trỏ đang đứng (Nhưng chỉ hạn chế trong môt khung nhìn của màn hình) |
Ctrl-Up Arrow |
Ngược lại với hành động trên. Thêm một chú ý nữa là: khi dịch chuyển quá một màn hình thì con trỏ sẽ dịch chuyển theo và vị trí của con trỏ luôn là dòng đầu hoặc dòng cuối của màn hình tương ứng với việc chuyển lên hay xuống. |
Ctrl-Right Arrow |
Dịch chuyển con trỏ đến từ tiếp theo ở bên phải |
Ctrl-Left Arrow |
Dịch chuyển con trỏ đến từ tiếp theo ở bên trái |
Ctrl-Shift-1 |
Chuyển hướng con trỏ đến vị trí của Định nghĩa hàm,khai báo hàm hoặc tham chiếu của đối tượng |
Ctrl-Shift-2 |
Tương tự như trên (Ctrl – Shift – 1). |
Shortcut | Description |
Tab |
Làm cho một hoặc nhiều dòng được bôi đen lui vào một Tab sang bên phải |
Shift-Tab |
Ngược lại với hành động trên. |
Backspace or Shift-Backspace |
Xóa một kí tự bên trái của con trỏ |
Ctrl-K, Ctrl-C |
Đánh dấu một dòng hay môt đoạn code thành một “Comment” – Dòng chú thích |
Ctrl-K, Ctrl-U |
Ngược lại với hành động trên, Xóa bỏ định dạng chú thích của dòng hoặc đoạn code trở lại ban đầu |
Ctrl-T or Shift-Enter |
Đảo kí tự vị trí của 2 kí tự sát cạnh con trỏ. (Ví dụ, AC|BD sẽ trở thành AB|CD.) Chỉ thích hợp cho các văn bản định dạng Text. |
Ctrl-K, Ctrl-L |
Xóa bỏ những BookMarks không được đánh dấu tên trong văn bản hiện tại. |
Ctrl-M, Ctrl-O |
Tự động thu gọn các đoạn mã trong một hàm và ẩn chúng đi. |
Alt-Right Arrow or Ctrl-Spacebar |
Hiển thị những gợi ý và cú pháp dựa trên từ đang viết dở. |
Ctrl-K, Ctrl-\ |
Xóa bỏ những khoảng trống trên cùng một hàng ngang của dòng bôi đen hoặc những khoảng trông liền kề với con trỏ nều không bôi đen. |
Ctrl-K, Ctrl-F |
Đặt một khung định dạng ở ngoài lề đối với đoạn văn bản được lựa chọn. Khi đó ta sẽ không thể đặt được điểm BreakPoint cho dòng đó. |
Ctrl-L |
Lưu Dòng hiện tại hoặc vào bộ đệm. |
Ctrl-Shift-L |
Xóa tất cả dòng đã chọn hoặc dòng hiện tại. |
Ctrl-Enter |
Thêm một dòng trống ở ngay dưới vị trí con trỏ |
Ctrl-Shift-Enter |
Thêm một dòng trống ở trên vị trí con trỏ |
Shift-Alt-T |
Đổi chỗ dòng chứa con trỏ với dòng ngay bên dưới nó. |
Ctrl-J |
Lên danh sách các thành viên cho sự hoàn thành câu lệnh khi sửa mã. |
Ctrl-U |
Biến các kí tự được chọn thành các kí tự thường. |
Ctrl-Shift-U |
Biến các kí tự được chọn thành các kí tự hoa. |
Ctrl-Shift-Spacebar |
Hiển thị một chú thích chứa thông tin về các tham số hiện tại dựa trên ngôn ngữ đang dùng. |
Ctrl-M, Ctrl-U |
Xóa bỏ những thông tin nháp đối với vùng được lựa chọn. |
Ctrl-M, Ctrl-P |
Xóa bỏ tất cả các thông tin nháp trong toàn bộ văn bản. |
Ctrl-R, Ctrl-P |
Đổi điểm đầu và điểm cuối của vùng được lựa chọn hiện tại. |
Ctrl-M, Ctrl-L |
Chuyển tất cả các vùng văn bản ẩn đã được đánh dấu trước đó giữa 2 trạng thái ẩn và hiện |
Ctrl-K, Ctrl-K |
Thiết lập hoặc xóa bỏ sự đánh dấu của dòng hiện tại. |
Ctrl-M, Ctrl-M |
Chốt đoạn văn bản ẩn được chọn hiện tại hoặc đoạn chứa con trỏ nếu không có sự lựa chọn giữa trạng thái ẩn và hiện. |
Ctrl-K, Ctrl-H |
Thiết lập hoặc xóa bỏ một shortcut trong danh sách nhiệm vụ đối với dòng hiện tại |
Ctrl-R, Ctrl-R |
Cho phép hoặc xóa bỏ đóng gói các từ trong bộ soạn thảo. |
Ctrl-R, Ctrl-W |
Ẩn hoặc hiện các dấu chấm từ đầu dòng cho đến kí tự đầu tiên |
Ctrl-Delete |
Xóa từ bên phải của con trỏ |
Ctrl-Backspace |
Xóa từ bên trái của con trỏ |
Ctrl-Shift-T |
Đảo 2 từ theo chiều đi của con trỏ. |
Shortcut | Description |
Shift-Left Arrow |
Bôi đen, hoặc lựa chọn đoạn mã tính từ vị trí con trỏ sang bên trái. |
Shift-Alt-Left Arrow |
Bôi đen, hoặc lựa chọn cả cột đoạn mã trong dòng chứa con trỏ và bên trái tính từ vị trí của con trỏ. |
Shift-Right Arrow |
Bôi đen, hoặc lựa chọn đoạn mã tính từ vị trí con trỏ sang bên phải. |
Shift-Alt-Right Arrow |
Bôi đen, hoặc lựa chọn cả cột đoạn mã trong dòng chứa con trỏ và bên phải tính từ vị trí của con trỏ. |
Ctrl-Shift-End |
Bôi đen đoạn mã tính từ vị trí con trỏ đến cuối cùng của trang. |
Ctrl-Shift-Home |
Bôi đen đoạn mã tính từ vị trí con trỏ đến đầu trang. |
Ctrl-Shift-] |
Đánh dấu một đoạn code trong một cặp dấu ngoặc. |
Shift-Down Arrow |
Đánh dấu một dòng bên dưới vị trí con trỏ (bắt đầu từ vị trí của con trỏ). |
Shift-Alt-Down Arrow |
Đánh dấu một dòng bên dưới vị trí con trỏ (Cả dòng chứa con trỏ) |
Shift-End |
Bôi đen đoạn mã tính từ vị trí của con trỏ đến cuối dòng |
Shift-Alt-End |
Bôi đen đoạn mã tính từ vị trí của con trỏ đến cuối dòng |
Shift-Home |
Bôi đen đoạn mã tính từ vị trí của con trỏ đến đầu dòng |
Shift-Alt-Home |
Bôi đen đoạn mã tính từ vị trí của con trỏ đến đầu dòng |
Shift-Up Arrow |
Bôi đen đoạn mã tình từ vị trí con trỏ với dòng ở trên. |
Shift-Alt-Up Arrow |
Bôi đen đoạn mã tình từ dòng chứa con trỏ với dòng ở trên. |
Shift-Page Down |
Bôi đen 1 trang đoạn mã, tính từ vị trí con trỏ trở lên trên |
Shift-Page Up |
Bôi đen 1 trang đoạn mã, tính từ vị trí con trỏ xuống dưới. |
Ctrl-A |
Selects everything in the current document |
Ctrl-W |
Selects the word containing the cursor or the word to the right of the cursor |
Ctrl-= |
Selects from the current location in the editor back to the previous location in the navigation history |
Ctrl-Shift-Page Down |
Moves the cursor to the last line in view, extending the selection |
Ctrl-Shift-Page Up |
Moves the cursor to the top of the current window, extending the selection |
Ctrl-Shift-Alt-Right Arrow |
Moves the cursor to the right one word, extending the column selection |
Ctrl-Shift-Left Arrow |
Moves the cursor one word to the left, extending the selection |
Ctrl-Shift-Alt-Left Arrow |
Moves the cursor to the left one word, extending the column selection |
Shortcut | Description |
Ctrl-Shift-B |
Builds the solution |
Ctrl-N |
Displays the New File dialog. Note: files created this way are not associated with a project. Use Ctrl-Shift-A to add a new file in a project |
Ctrl-Shift-N |
Displays the New Project dialog |
Ctrl-O |
Displays the Open File dialog |
Ctrl-Shift-O |
Displays the Open Project dialog |
Shift-Alt-A |
Displays the Add Existing Item dialog |
Ctrl-Shift-A |
Displays the Add New Item dialog |
Ctrl-Alt-Insert |
Allows you to override base class methods in a derived class when an overridable method is highlighted in the Class View pane |
Shortcut | Description |
Shift-Alt-Enter |
Toggles full screen mode |
Ctrl-+ |
Goes back to the previous location in the navigation history. (For example, if you press Ctrl-Home to go to the start of a document, this shortcut will take the cursor back to wherever it was before you pressed Ctrl-Home.) |
Ctrl-Shift-+ |
Moves forward in the navigation history. This is effectively an undo for the View.NavigateBackward operation |
Ctrl-F4 |
Closes the current MDI child window |
Shift-Esc |
Closes the current tool window |
Ctrl-F2 |
Moves the cursor to the navigation bar at the top of a code view |
Ctrl-Tab |
Cycles through the MDI child windows one window at a time |
Ctrl-F6, Ctrl-Shift-Tab |
Moves to the previous MDI child window |
Alt-F6, Ctrl-Shift-F6 |
Moves to the next tool window |
Shift-Alt-F6 |
Moves to the previously selected window |
F6 |
Moves to the next pane of a split pane view of a single document |
Shift-F6 |
Moves to the previous pane of a document in split pane view |
Ctrl-Pagedown |
Moves to the next tab in the document or window (e.g., you can use this to switch the HTML editor from its design view to its HTML view |
Ctrl-PageUp |
Moves to the previous tab in the document or window |
Shortcut | Description |
Ctrl-Down Arrow |
Moves the selected control down in increments of one on the design surface |
Down Arrow |
Moves the selected control down to the next grid position on the design surface |
Ctrl-Left Arrow |
Moves the control to the left in increments of one on the design surface |
Left Arrow |
Moves the control to the left to the next grid position on the design surface |
Ctrl-Right Arrow |
Moves the control to the right in increments of one on the design surface |
Right Arrow |
Moves the control to the right into the next grid position on the design surface |
Ctrl-Up Arrow |
Moves the control up in increments of one on the design surface |
Up Arrow |
Moves the control up into the next grid position on the design surface |
Tab |
Moves to the next control in the tab order |
Shift-Tab |
Moves to the previous control in the tab order |
Ctrl-Shift-Down Arrow |
Increases the height of the control in increments of one on the design surface |
Shift-Down Arrow |
Increases the height of the control to the next grid position on the design surface |
Ctrl-Shift-Left Arrow |
Reduces the width of the control in increments of one on the design surface |
Shift-Left Arrow |
Reduces the width of the control to the next grid position on the design surface |
Ctrl-Shift-Right Arrow |
Increases the width of the control in increments of one on the design surface |
Shift-Left Arrow |
Increases the width of the control to the next grid position on the design surface |
Ctrl-Shift-Up Arrow |
Decreases the height of the control in increments of one on the design surface |
Shift-Up Arrow |
Decreases the height of the control to the next grid position on the design surface |
Shortcut | Description |
Ctrl-F |
Displays the Find dialog |
Ctrl-Shift-F |
Displays the Find in Files dialog |
F3 |
Finds the next occurrence of the previous search text |
Ctrl-F3 |
Finds the next occurrence of the currently selected text or the word under the cursor if there is no selection |
Shift-F3 |
Finds the previous occurrence of the search text |
Ctrl-Shift-F3 |
Finds the previous occurrence of the currently selected text or the word under the cursor |
Ctrl-D |
Places the cursor in the Find/Command line on the Standard toolbar |
Alt-F3, H |
Selects or clears the Search Hidden Text option for the Find dialog |
Ctrl-I |
Starts an incremental search—after pressing Ctrl-I, you can type in text, and for each letter you type, VS.NET will find the first occurrence of the sequence of letters you have typed so far. This is a very convenient facility, as it lets you find text by typing in exactly as many characters as are required to locate the text and no more. If you press Ctrl-I a second time without typing any characters, it recalls the previous pattern. If you press it a third time or you press it when an incremental search has already found a match, VS.NET searches for the next occurrence. |
Alt-F3, C |
Selects or clears the Match Case option for Find and Replace operations |
Alt-F3, R |
Selects or clears the Regular Expression option so that special characters can be used in Find and Replace operations |
Ctrl-H |
Displays the Replace dialog |
Ctrl-Shift-H |
Displays the Replace in Files dialog |
Ctrl-Shift-I |
Performs an incremental search in reverse direction |
Alt-F3, S |
Halts the current Find in Files operation |
Alt-F3, B |
Selects or clears the Search Up option for Find and Replace operations |
Alt-F3, W |
Selects or clears the Match Whole Word option for Find and Replace operations |
Alt-F3, P |
Selects or clears the Wildcard option for Find and Replace operations |
Shortcut | Description |
Ctrl-Alt-F1 |
Displays the Contents window for the documentation |
Ctrl-F1 |
Displays the Dynamic Help window, which displays different topics depending on what items currently have focus. If the focus is in a source window, the Dynamic Help window will display help topics that are relevant to the text under the cursor |
F1 |
Displays a topic from Help that corresponds to the part of the user interface that currently has the focus. If the focus is in a source window, Help will try to display a topic relevant to the text under the cursor |
Ctrl-Alt-F2 |
Displays the Help Index window |
Shift-Alt-F2 |
Displays the Index Results window, which lists the topics that contain the keyword selected in the Index window |
Alt-Down Arrow |
Displays the next topic in the table of contents. Available only in the Help browser window |
Alt-Up Arrow |
Displays the previous topic in the table of contents. Available only in the Help browser window |
Ctrl-Alt-F3 |
Displays the Search window, which allows you to search for words or phrases in the documentation |
Shift-Alt-F3 |
Displays the Search Results window, which displays a list of topics that contain the string searched for from the Search window. |
Shift-F1 |
Displays a topic from Help that corresponds to the user interface item that has the focus |
Shortcut | Description |
Ctrl-Alt-V, A |
Displays the Auto window to view the values of variables currently in the scope of the current line of execution within the current procedure |
Ctrl-Alt-Break |
Temporarily stops execution of all processes in a debugging session. Available only in run mode |
Ctrl-Alt-B |
Displays the Breakpoints dialog, where you can add and modify breakpoints |
Ctrl-Alt-C |
Displays the Call Stack window to display a list of all active procedures or stack frames for the current thread of execution. Available only in break mode |
Ctrl-Shift-F9 |
Clears all of the breakpoints in the project |
Ctrl-Alt-D |
Displays the Disassembly window |
Ctrl-F9 |
Enables or disables the breakpoint on the current line of code. The line must already have a breakpoint for this to work |
Ctrl-Alt-E |
Displays the Exceptions dialog |
Ctrl-Alt-I |
Displays the Immediate window, where you can evaluate expressions and execute individual commands |
Ctrl-Alt-V, L |
Displays the Locals window to view the variables and their values for the currently selected procedure in the stack frame |
Ctrl-Alt-M, 1 |
Displays the Memory 1 window to view memory in the process being debugged. This is particularly useful when you do not have debugging symbols available for the code you are looking at. It is also helpful for looking at large buffers, strings, and other data that does not display clearly in the Watch or Variables window |
Ctrl-Alt-M, 2 |
Displays the Memory 2 window |
Ctrl-Alt-M, 3 |
Displays the Memory 3 window |
Ctrl-Alt-M, 4 |
Displays the Memory 4 window |
Ctrl-Alt-U |
Displays the Modules window, which allows you to view the .dll or .exe files loaded by the program. In multiprocess debugging, you can right-click and select Show Modules for all programs |
Ctrl-B |
Opens the New Breakpoint dialog |
Ctrl-Alt-Q |
Displays the Quick Watch dialog with the current value of the selected expression. Available only in break mode. Use this command to check the current value of a variable, property, or other expression for which you have not defined a watch expression |
Ctrl-Alt-G |
Displays the Registers window, which displays CPU register contents |
Ctrl-Shift-F5 |
Terminates the current debugging session, rebuilds if necessary, and then starts a new debugging session. Available in break and run modes |
Ctrl-Alt-N |
Displays the Running Documents window that displays the set of HTML documents that you are in the process of debugging. Available in break and run modes |
Ctrl-F10 |
Starts or resumes execution of your code and then halts execution when it reaches the selected statement. This starts the debugger if it is not already running |
Ctrl-Shift-F10 |
Sets the execution point to the line of code you choose |
Alt-NUM * |
Highlights the next statement to be executed |
F5 |
If not currently debugging, this runs the startup project or projects and attaches the debugger. If in break mode, this allows execution to continue (i.e., it returns to run mode). |
Ctrl-F5 |
Runs the code without invoking the debugger. For console applications, this also arranges for the console window to stay open with a “Press any key to continue” prompt when the program finishes |
F11 |
Executes code one statement at a time, tracing execution into function calls |
Shift-F11 |
Executes the remaining lines of a function in which the current execution point lies |
F10 |
Executes the next line of code but does not step into any function calls |
Shift-F5 |
Available in break and run modes, this terminates the debugging session |
Ctrl-Alt-V, T |
Displays the This window, which allows you to view the data members of the object associated with the current method |
Ctrl-Alt-H |
Displays the Threads window to view all of the threads for the current process |
F9 |
Sets or removes a breakpoint at the current line |
Ctrl-F11 |
Displays the disassembly information for the current source file. Available only in break mode |
Ctrl-Alt-W, 1 |
Displays the Watch 1 window to view the values of variables or watch expressions |
Ctrl-Alt-W, 2 |
Displays the Watch 2 window |
Ctrl-Alt-W, 3 |
Displays the Watch 3 window |
Ctrl-Alt-W, 4 |
Displays the Watch 4 window |
Ctrl-Alt-P |
Displays the Processes dialog, which allows you to attach or detach the debugger to one or more running processes |
Shortcut | Description |
Alt-F12 |
Displays the Find Symbol dialog |
Ctrl-F12 |
Displays the declaration of the selected symbol in the code |
F12 |
Displays the definition for the selected symbol in code |
Ctrl-Alt-F12 |
Displays the Find Symbol Results window |
Ctrl-Alt-J |
Displays the Object Browser to view the classes, properties, methods, events, and constants defined either in your project or by components and type libraries referenced by your project |
Alt-+ |
Moves back to the previously selected object in the selection history of the object browser |
Shift-Alt-+ |
Moves forward to the next object in the selection history of the object browser |
Shortcut | Description |
Ctrl-Shift-M |
Toggles the Command window into or out of a mode allowing text within the window to be selected |
Ctrl-Shift-C |
Displays the Class View window |
Ctrl-Alt-A |
Displays the Command window, which allows you to type commands that manipulate the IDE |
Ctrl-Alt-T |
Displays the Document Outline window to view the flat or hierarchical outline of the current document |
Ctrl-Alt-F |
Displays the Favorites window, which lists shortcuts to web pages |
Ctrl-Alt-O |
Displays the Output window to view status messages at runtime |
F4 |
Displays the Properties window, which lists the design-time properties and events for the currently selected item |
Shift-F4 |
Displays the property pages for the item currently selected. (For example, use this to show a project’s settings.) |
Ctrl-Shift-E |
Displays the Resource View window |
Ctrl-Alt-S |
Displays the Server Explorer window, which allows you to view and manipulate database servers, event logs, message queues, web services, and many other operating system services |
Ctrl-Alt-R |
Displays the web browser window, which allows you to view pages on the Internet |
Ctrl-Alt-L |
Displays the Solution Explorer, which lists the projects and files in the current solution |
Ctrl-Alt-K |
Displays the TaskList window, which displays tasks, comments, shortcuts, warnings, and error messages |
Ctrl-Alt-X |
Displays the Toolbox, which contains controls and other items that can be dragged into editor and designer windows |
Shortcut | Description |
Ctrl-B |
Toggles the selected text between bold and normal |
Ctrl-Shift-T |
Decreases the selected paragraph by one indent unit |
Ctrl-T |
Indents the selected paragraph by one indent unit |
Ctrl-I |
Toggles the selected text between italic and normal |
Ctrl-Shift-K |
Prevents an absolutely positioned element from being inadvertently moved. If the element is already locked, this unlocks it |
Ctrl-G |
Toggles the grid |
Ctrl-Shift-G |
Specifies that elements be aligned using an invisible grid. You can set grid spacing on the Design pane of HTML designer options in the Options dialog, and the grid will be changed the next time you open a document |
Ctrl-U |
Toggles the selected text between underlined and normal |
Ctrl-Shift-L |
Displays the Bookmark dialog |
Ctrl-J |
Inserts <div></div> in the current HTML document |
Ctrl-L |
When text is selected, displays the Hyperlink dialog |
Ctrl-Shift-W |
Displays the Insert Image dialog |
Ctrl-Alt-Up Arrow |
Adds one row above the current row in the table |
Ctrl-Alt-Down Arrow |
Adds one row below the current row in the table |
Ctrl-Alt-Left Arrow |
Adds one column to the left of the current column in the table |
Ctrl-Alt-Right Arrow |
Adds one column to the right of the current column in the table |
Ctrl-Shift-Q |
Toggles display of marker icons for HTML elements that do not have a visual representation, such as comments, scripts, and anchors for absolutely positioned elements |
Ctrl-Page Down |
Switches from design view to HTML view and vice versa |
Ctrl-Q |
Displays a 1-pixel border around HTML elements that support a BORDER attribute and have it set to zero, such as tables, table cells, and divisions |
Shortcut | Description |
Alt-F8 |
Displays the Macro Explorer window, which lists all available macros |
Alt-F11 |
Launches the macros IDE |
Ctrl-Shift-R |
Places the environment in macro record mode or completes recording if already in record mode |
Ctrl-Shift-P |
Plays back a recorded macro |