Total Pageviews

Saturday, December 19, 2009

Thanks for coming to today’s session! As I’ve said (or about to say), don’t take notes! Here are all the tips for you. Just sit back, relax, and enjoy the show!

0. Know your Keybindings! All these are in the General Development Settings.

Searching

1. How to behold the power of incremental search

http://blogs.msdn.com/saraford/archive/2007/07/23/did-you-know-behold-the-power-of-incremental-search.aspx

Command: Edit.IncrementalSearch

Shortcut: Ctrl+i

2. Ctrl+F3 to search for currently-selected word

http://blogs.msdn.com/saraford/archive/2007/10/26/did-you-know-ctrl-f3-searches-for-the-currently-selected-string-without-brining-up-the-find-window.aspx

Command: Edit.FindNextStatement

3. F3 to search for last thing you searched for

http://blogs.msdn.com/saraford/archive/2007/10/25/did-you-know-f3-searches-for-the-last-thing-you-searched-for.aspx

Command: Edit.FindNext

4. Customize what files to find in

http://blogs.msdn.com/saraford/archive/2007/11/07/did-you-know-how-to-customize-what-files-to-find-in.aspx

Find In Files – Look in – Choose Search Folders

5. You can use a reg hack for customizing search results

http://blogs.msdn.com/saraford/archive/2008/11/24/did-you-know-you-can-customize-how-search-results-are-displayed-in-the-find-results-window-363.aspx

HKCU\Software\Microsoft\VisualStudio\9.0\Find String Find=$f$e($l,$c):$t\r\n

Editing

6. How not to accidentally copy a blank line

http://blogs.msdn.com/saraford/archive/2007/09/28/did-you-know-how-not-to-accidentally-copy-a-blank-line.aspx

Tools – Options – Text Editor – All Languages – General, Uncheck Apply cut or copy to blank lines

7. How to cycle through the Clipboard ring

http://blogs.msdn.com/saraford/archive/2007/10/01/did-you-know-how-to-cycle-through-the-clipboard-ring-to-paste-different-things.aspx

Command: Edit.CycleClipboardRing

Shortcut: Ctrl+Shift+v

8. How to use box/column selection in the editor

http://blogs.msdn.com/saraford/archive/2007/07/27/did-you-know-how-to-do-box-selection-in-the-editor.aspx

Command: Edit.LineUpColumnExtend, Edit.LineDownColumnExtend, Edit.CharRightColumnExtend, Edit.CharLeftColumnExtend

Shortcut: Shift+Alt+Arrow

9. You can copy a file’s full path / open windows explorer from the file tab channel

http://blogs.msdn.com/saraford/archive/2008/01/09/did-you-know-you-can-copy-a-file-s-full-path-from-the-file-tab-channel.aspx

Command: File.CopyFullPath

10. Drag and drop code onto the toolbox’s general tab

http://blogs.msdn.com/saraford/archive/2008/04/10/did-you-know-you-can-drag-and-drop-code-onto-the-toolbox-general-tab-191.aspx

11. You can use Ctrl+. to show a smart tag

http://blogs.msdn.com/saraford/archive/2008/11/18/did-you-know-ctrl-shows-a-smart-tag-359.aspx

Command: View.ShowSmartTag

12. You can insert a snippet by pressing Tab Tab

http://blogs.msdn.com/saraford/archive/2008/06/10/did-you-know-you-can-insert-a-snippet-via-tab-tab-234.aspx

Type in snippet shortcut, then press Tab Tab

Customizing

13. You can create temp or throw away projects

http://blogs.msdn.com/saraford/archive/2008/02/25/did-you-know-you-can-create-temp-or-throw-away-projects-158.aspx

Tools - Options - Projects and Solutions - General, uncheck Save new projects when created

14. Change text editor font size via keyboard (Accessibility macros)

http://blogs.msdn.com/saraford/archive/2008/06/20/did-you-know-you-can-bind-macros-to-keyboard-shortcuts-or-how-to-quickly-increase-decrease-your-text-editor-font-size-242.aspx

Command: Macros.Samples.Accessibility.DecreaseTextEditorFontSize

Command: Macros.Samples.Accessibility.IncreaseTextEditorFontSize

15. How to open a file without any UI

http://blogs.msdn.com/saraford/archive/2007/11/26/did-you-know-how-to-have-fun-with-the-find-combo-box.aspx

Ctrl+/ (or whatever Tools.GoToCommandLine is bound to)

alias fo file.openfile

fo

16. Guidelines in the editor registry key hack

http://blogs.msdn.com/saraford/archive/2008/04/01/did-you-know-you-can-display-guidelines-in-the-editor-and-tip-of-the-day-ends-today-184.aspx

HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\9.0\Text Editor String RBG(128,0,0) 5, 20

17. You can create a macro for your import/export settings – see http://blog.jeffhandley.com/archive/2009/03/31/vs-profiles.aspx

http://blogs.msdn.com/saraford/archive/2008/12/05/did-you-know-you-can-create-toolbar-buttons-to-quickly-toggle-your-favorite-vs-settings-371.aspx

18. How to not show the start page (or have the last loaded solution open)

http://blogs.msdn.com/saraford/archive/2008/01/03/did-you-know-how-to-customize-what-visual-studio-opens-to-or-how-to-make-the-start-page-not-show-up-when-vs-opens.aspx

Tools - Options - Environment - Startup, At Startup

19. File tab channel registry hack

http://blogs.msdn.com/saraford/archive/2008/10/09/did-you-know-you-can-keep-recently-used-files-from-falling-off-the-file-tab-channel-331.aspx

HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\9.0 key, you can create a DWORD UseMRUDocOrdering = 1

20. How to show Misc Files Project to keep your files around

http://blogs.msdn.com/saraford/archive/2008/01/01/did-you-know-how-to-show-the-miscellaneous-files-project-in-the-solution-explorer.aspx

tools - options - environment – documents, show miscellaneous files in Solution Explorer

21. Edit project file from within IDE (unload project)
http://blogs.msdn.com/saraford/archive/2008/10/10/did-you-know-how-to-edit-a-csproj-or-vbproj-project-file-within-the-ide-332.aspx

Unload project, edit project, reload project

Debugging

22. You can use tracepoints to log stuff in your code

http://blogs.msdn.com/saraford/archive/2008/06/13/did-you-know-you-can-use-tracepoints-to-log-printf-or-console-writeline-info-without-editing-your-code-237.aspx

Right-click in indicator margin, select breakpoints, select Insert Tracepoint

23. How to get the find source dialog back

http://blogs.msdn.com/saraford/archive/2008/09/17/did-you-know-how-to-get-the-find-source-dialog-back-instead-of-the-there-is-no-source-code-available-message-315.aspx

Solution Properties, under Common Properties - Debug Source Files, Delete Do no look for these source files edit box contents

24. You can disable the exception assistant

http://blogs.msdn.com/saraford/archive/2008/08/05/did-you-know-you-can-disable-the-exception-assistant-274.aspx

Tools – Options – Debugging – General, uncheck Enable the Exception Assistant

25. You can use the XML Visualizer

http://blogs.msdn.com/saraford/archive/2008/09/25/did-you-know-you-can-use-the-xml-visualizer-to-view-xml-321.aspx

Drop down the little down arrow on the data tip or in the watch window.

Posted: Wednesday, September 09, 2009 10:02 PM by saraford | 8 Comments Filed under:

Wednesday, November 4, 2009

Creating a Transactions

Dim _Connection As DbConnection = Nothing
Dim _Transaction As DbTransaction = Nothing

Try


Dim _DB As Database = DatabaseFactory.CreateDatabase(BL_DBCONNECTION_STRING)
_Connection = _DB.CreateConnection
_Connection.Open()
_Transaction = _Connection.BeginTransaction()

gvPurchasings.PostEditor()



With BLPurchasings
.PurchasingID = Convert.ToInt64(IIf(lblID.Text = String.Empty, 0, lblID.Text))
.VendorID = leVendors.EditValue
.PurchaseDate = dePurchaseDate.EditValue
.VoucherNo = teVoucherNo.EditValue
.Note = meeNote.EditValue
.TotalAmount = Convert.ToDecimal(IIf(Not IsDBNull(gvPurchasings.Columns("Amount")), gvPurchasings.Columns("Amount").SummaryText, 0))
.Discount = seDiscount.EditValue
.TaxAmount = seTaxAmount.EditValue
.TotalPayable = seTotalPayable.EditValue
.CreatedBy = UserID
.UpdatedBy = UserID
.Insert(_DB, _Transaction)
End With


With BLPruchasingsDescription
For i As Integer = 0 To Me.gvPurchasings.RowCount
If Not gvPurchasings.GetRowCellDisplayText(i, gvPurchasings.Columns(0)) = "" Then
.PurchasingID = BLPurchasings.NewPurchasingID
.StockID = Me.gvPurchasings.GetRowCellDisplayText(i, GridColumn1)
.Quantity = Val(Me.gvPurchasings.GetRowCellDisplayText(i, GridColumn4))
.PurchasePrice = Val(Me.gvPurchasings.GetRowCellDisplayText(i, GridColumn22))
.Discount = Val(Me.gvPurchasings.GetRowCellDisplayText(i, GridColumn5))
.Amount = Val(Me.gvPurchasings.GetRowCellDisplayText(i, GridColumn6))
.Insert(_DB, _Transaction)


.StockID = Me.gvPurchasings.GetRowCellDisplayText(i, GridColumn1)
.Amount = Val(Me.gvPurchasings.GetRowCellDisplayText(i, GridColumn4)) * Val(Me.gvPurchasings.GetRowCellDisplayText(i, GridColumn22))
.UpdateStockByPurchasings(_DB, _Transaction)

End If

Next

End With


_Transaction.Commit()

Dim frm As New frmSavedOk
frm.Text = BL_SAVESUCCESS_CONFIRMATION_TITLE
frm.lblTitle.Text = BL_SAVESUCCESS_CONFIRMATION_TITLELABEL
frm.lblDescription.Text = BL_SAVESUCCESS_CONFIRMATION_DESCRIPTIONLABEL
frm.ShowDialog()
Me.ClearFormData()



Catch ex As Exception
_Transaction.Rollback()
MessageError(ex.ToString)
Finally
If _Connection.State = ConnectionState.Open Then
_Connection.Close()
End If

End Try

Monday, October 26, 2009

Microsoft Enterprise Library

Download latest Microsoft Enterprise Library from www.microsoft.com, New and Easy way to access data.

Code you fast

Install Developer Express Code Rush and Refactor Pro! for quick coding