Content by Category
.NET 1.x
.NET 2.0
.NET 3.0
.NET 3.5
.NET 4.0
.NET 4.5
.NET Assemblies
.NET Framework
.NET Getting Started
Accessibility
ADO.NET
Advertorials
Agile Development
AJAX
Amazon Web Services
Analysis Services
Android
Architecture
Arduino
ASP .NET Web API
ASP.NET
ASP.NET MVC
ASP.NET WebForms
Azure
B2B (Business Integration)
BDD
Big Data
Bing
BizTalk
Book Excerpts
Build and Deploy
Business Intelligence
C#
C++
ClickOnce
Cloud Computing
Code Contracts
CODE Framework Info - non Technical
CODE on the Road!
COM+
Community
Conferences
Continuous Integration
Crystal Reports
CSLA.NET
CSS
Data
Debugger
Design Patterns
Development Process
Display Technologies
Distributed Computing
Document Database
DotNetNuke
DSL
Dynamic Languages
Dynamic Programming
Editorials
Enterprise Services ("COM+")
Entity Framework
Events
Expression Blend
F#
Fox to Fox
Frameworks
Functional Programming
Git
Graphics
HTML 5
Internet Explorer 8.0
Interviews
IOS
iPhone
Iron Ruby
Java
Java Script
JavaScript
jQuery
JSON
Lightswitch
LINQ
Linux
LUA
Mac OS X
MDX
Messaging
Metro
Microsoft Application Blocks
Microsoft Business Rules Framework
Microsoft Dynamics
Microsoft Expression
Microsoft Office
Mobile Development
Mobile PC
Mono
MsBuild
MVVM
MySQL
Network
NHibernate
node.js
NOSQL
Nuget
Object Oriented Development
Objective C
Odata
OLAP
Open Source
Opinion
Opinions
Oracle
ORM
Other Languages
Parallel Programming
Patterns
PHP
Podcasts
Post Mortem
PowerPoint
Print/Output
Prism
Product News
Product Reviews
Project Management
Prolog
Python
Q&A
Rails
Rake
Razor
Reporting Services
REST
RIA Services
Ruby
Ruby on Rails
Scheme
Search
Security
Services
SharePoint
SignalR
Silverlight
SOA
Social Networks
Software & Law
Software Business
Source Control
Speech-Enabled Applications
SQL Server
SQL Server 2000
SQL Server 2005
SQL Server 2008
SQL Server 2012
SQL Server CE/AnyWhere/Mobile/Compact
SSIS
Subversion
Sync Framework
Tablet PC
TDD
Team System
Techniques
Testing and Quality Control
TFS
Tips
TypeScript
UI Design
UML
User Groups
VB Script
VB.NET
Version Control
VFP and .NET
VFP and SQL Server
Virtual Earth
Vista
Visual Basic
Visual Basic 6 (and older)
Visual FoxPro
Visual Studio .NET
Visual Studio 11
Visual Studio 2005
Visual Studio 2008
Visual Studio 2010
Visual Studio 2011
Visual Studio 2012
Visual Studio Tools for Office
VSX
WCF
Web Development (general)
Web Services
WebMatrix
WF
Whitepapers
Windows 7
Windows 8
Windows Azure
Windows Live
Windows Phone 7
Windows Phone SDK
Windows Server
Windows Vista
WinForms
WinRT
Workflow
WPF
XAML
Xiine Documentation
XML
XNA
XSLT



LearnNow


XAMALOT
 


SSWUG

Reader rating:
Article source: CoDe (2011 Mar/Apr)

Ask the Doc Detective

Finding what you need in the Microsoft® Visual Studio® documentation, which has over 200,000 topics, can be a daunting task. The Doc Detective is here to help, utilizing his investigative skills to probe the depths of the documentation.

Can’t find what you’re looking for? Just ask - if it’s in there, I’ll find it for you; if it isn’t, I’ll let you know that as well (and tell you where else you might go to find it).

Have a question for the Doc? Send your questions for future columns to me at docdetec@microsoft.com.

Dear Doc Detective,

I’m writing an order entry application in Visual Studio LightSwitch, and my users are asking for better feedback when an order is saved. I would like to add a message telling them that the order was successfully saved and also to remind them to update the order tracking Excel spreadsheet. Any ideas?

- Saved in Sarasota

Dear Saved,

I have plenty of ideas, most not fit for publication. As for providing feedback, you can add code in the <ScreenName>_Saved method for your screen to display a message box:

Private Sub OrdersScreen_Saved()
    ShowMessageBox(“Order was saved. Don’t 
forget to update the order tracking 
spreadsheet!”)
End Sub

You can do pretty much anything you want in the Saved method - for example, instead of reminding the user to update the spreadsheet you could use COM automation to update the spreadsheet for them.

The Saved method is described in the topic “How to: Add, Remove, or Modify Commands for a Screen.” You might also be interested in the Saving method which occurs before the changes are committed, and the SaveError method which occurs when changes can’t be saved.

- the Doc

Dear Doc Detective,

In my LightSwitch application I have a screen that displays customers. I would like to limit the display to only customers that have not been contacted in the past six months.

I’ve played around with the Query designer, but it seems fairly limited in its capabilities and I can’t find a way to do this. Surely LightSwitch isn’t that limiting - or is it?

- Limited in Linville

Dear Limited,

Although the Query designer is fairly limited in terms of the types of queries you can create, you can always write code to extend a query.

LightSwitch supports LINQ syntax, so any query that can be defined using LINQ can be used to define the data that will be displayed on a screen. The topic “How to: Extend a Query by Using Code” shows several examples of using LINQ to - you guessed it - extend a query.

- Doctor D

Dear Doc Detective,

I saw your answer on LightSwitch authentication and authorization in your last column. I followed the instructions in the referenced topic and it works like a charm - so far, so good.

There is one thing that I can’t figure out, though. I can create users and roles in my published application, but how do I impersonate a user at design time for testing purposes?

- Rolling in Rollag

Dear Rolling,

It’s always rewarding to see that someone really does read this column. The answer is, you can’t - well, not exactly.

While you can’t log on as a different user, you can set debug permissions at design time, which essentially does the same thing. On the Access Control tab of the Application designer, check the “Granted for debug” checkbox for each permission that you have defined for a particular user or role. When you run the app, you will have the same access that your user will have in the published app.

This is demonstrated in the “Using Debug Permissions to Test Code” lesson in the “LightSwitch Guided Tour” tutorial.

- the Doc

Dear Doc Detective,

I have a question. I would like to get a count of the records returned by my LightSwitch query and display them on my screen. How would I do that?

- Questioning in Queens

Dear Questioning,

To your one question I have a two-part answer. To get a count, create a query and extend it using LINQ to return a count. You can then get the count by calling the Execute method of the resulting query:

Dim recordCount As Integer

recordCount = Me.DataWorkspace.DataSourceName.
MyQueryName.Execute().Count

You may wonder why you need to execute the query instead of simply returning the Count property of the Query object. The Count property returns the query collection associated with the screen, and if you have more than one page of data it will return the count only for the first page.

To display the count on your screen, you can add a label as shown in the topic “How to: Add a Local Field to a Screen” and assign recordCount as its value.

- the Doc

Doc’s Doc Tip of the Day

Frustrated with the new Help viewer in Visual Studio 2010? You’re not alone. Fortunately relief is coming in Visual Studio 2010 SP1, with a number of usability improvements.

You can read all about them in Jeff Braaten’s blog “The Story of Help in Visual Studio 2010 (Part 3)”.

Found a topic in Help that doesn’t help? Tell the Visual Studio documentation team about it by clicking on the “Send feedback” link in local Help topics, or the “Click to rate and give feedback” link in online Help.

URLs


How would you rate the quality of this article?
1 2 3 4 5
Poor      Outstanding

Tell us why you rated the content this way. (optional)

Average rating:
4.5 out of 5

6 people have rated this article.

Instantly Search Terabytes Of Text
“Lightning Fast”
– Redmond Mag
“Covers all data
sources” – eWeek
25+ fielded & full-text search options
dtSearch’s own document filters highlight hits in popular file types
Web Spider supports static & dynamic data
APIs for .NET, Java, C++, SQL, etc.
Win / Linux (64-bit & 32-bit)
www.dtSearch.com
 

      Sharepoint TechCon

 

Sharepoint TechCon