By Darren McLeod on
Friday, May 16, 2008 4:31 AM
If you have an EnvDTE.Project reference to an existing Solution Folder you can add a solution folder like so:
C#
((EnvDTE80.SolutionFolder)root.Object).AddSolutionFolder("solutionFolder");
or VB
DirectCast(root.[Object], EnvDTE80.SolutionFolder).AddSolutionFolder("solutionFolder")
where "root" is the EnvDTE.Project reference to the existing Solution Folder.
|
By Darren McLeod on
Saturday, May 10, 2008 5:34 AM
To unlock a file in Team Foundation Server you have to issue the following command at the Visual Studio Command Prompt:
TF UNDO filename /WORKSPACE:workspace;checkout_user /SERVER:servername
Where you change the lower case words with your particular case. For more information go here:
|
By Darren McLeod on
Saturday, April 19, 2008 6:09 AM
Every once in a while I need to search and replace a character with a "return" character and I forget how to do it and have to search online. This latest search I found the answer here:
http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=112303
In your search dialog turn on regular expressions and use "\x0d\x0a" for the "return" character.
|
By Darren McLeod on
Saturday, March 08, 2008 4:54 AM
I had changed the name of a class to match Code Analysis class name criteria that specifies what parts of a class name should be upper case/lower case. I did a global search and replace. Some time later I ran a unit test and got this error:
System.TypeLoadException: Could not load type
After a bit of research I discovered that even though the class I had changed casing on was a VB class the unit test class is case sensitive.
|
By Darren McLeod on
Sunday, February 03, 2008 6:44 PM
If your using the ASP.NET 2.0 Wizard control and you want to stop the next button from going to the next step you have to set the event arg property Cancel to true like so:
Private Sub Wizard1_NextButtonClick(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.WizardNavigationEventArgs) Handles Wizard1.NextButtonClick
e.Cancel = True
End Sub
...
Read More »
|
By Darren McLeod on
Thursday, January 24, 2008 5:38 PM
Was using the MaintainScrollPositionOnPostback=true in a page directive with the ASP.Net 2.0 Wizard control and started getting a stack overflow error when clicking on a Sidebar button. Could not find a decent fix so I opted for a workaround and removed the MaintainScrollPositionOnPostback attribute and implemented this:
http://aspnet.4guysfromrolla.com/articles/111704-1.2.aspx
|
By Darren McLeod on
Monday, December 31, 2007 11:53 AM
Say you had the following select:
select id="ItemSelect" runat="server">
option selected="selected">Select your itemoption>
option>Item oneoption>
option>Item twooption>
option>Item threeoption>
select>
And you wanted to force the user to select Item one/two/three. You could do this by creating a RegularExpressionValidator to to accept anything but the “Select your item” option like so:
asp:RegularExpressionValidator ID="ItemRegularExpressionValidator" runat="server" ControlToValidate="ItemSelect"
ErrorMessage="Item Required" Text="*" SetFocusOnError="true" ValidationExpression="^((?!Select your item).)*$">asp:RegularExpressionValidator>
...
Read More »
|
By Darren McLeod on
Thursday, December 20, 2007 6:41 PM
Say you had a GridView with a dropdownlist like this:
asp:GridView ID="testGridView" runat="server">
Columns>
asp:BoundField DataField="TestField" />
asp:TemplateField>
ItemTemplate>
asp:DropDownList ID="TestDropDownList" runat="server" AutoPostBack="true">
asp:ListItem Value="1">Item 1asp:ListItem>
asp:ListItem Value="2">Item 2asp:ListItem>
asp:DropDownList>
ItemTemplate>
asp:TemplateField>
Columns>
asp:GridView>
And you set it’s datasource in the page load event like this:
ProtectedSub Page_Load(ByVal sender AsObject, ByVal e As System.EventArgs) HandlesMe.Load
If Not Me.IsPostBack Then
Dim testTable As New DataTable
Dim testColumn As New DataColumn
testColumn.ColumnName = "TestField"
testColumn.DataType = GetType(String)
testTable.Columns.Add(testColumn)
Dim testRow As DataRow
testRow = testTable.NewRow
testRow.Item("TestField") = "Item...
Read More »
|
By Darren McLeod on
Tuesday, December 18, 2007 5:14 AM
If you want to get a list of the current objects private fields you can do so like this:
me.GetType.GetFields(system.Reflection.BindingFlags.Instance or Reflection.BindingFlags.NonPublic)
|
By Darren McLeod on
Monday, December 03, 2007 5:38 PM
If you get this error message when running an ASP.NET unit test in VS Team System 2005:
The web request 'http://localhost:19298/' completed successfully without running the test. This can occur when configuring the web application for testing fails (an ASP.NET server error occurs when processing the request), or when no ASP.NET page is executed (the URL may point to an HTML page, a web service, or a directory listing). Running tests in ASP.NET requires the URL to resolve to an ASP.NET page and for the page to execute properly up to the Load event. The response from the request is stored in the file 'WebRequestResponse_lnkGetMoreWork_Click.html' with the test results; typically this file can be opened with a web browser to view its contents.
Remove these lines/attributes from the unit test method declaration:
HostType("ASP.NET"), _
AspNetDevelopmentServerHost("%PathToWebRoot%", "/"), _
UrlToTest("http://localhost/")> _
...
Read More »
|