July 2006 Entries

VB.Net compiler error when compare with Nothing.

I've got a compiler error Compiler Error Message: BC30452: Operator '<>' is not defined for types 'BaseResultItemsListUsc' and 'BaseResultItemsListUsc'. If listResults <> Nothing ThenEnd If Of course, the correct code should be If listResults isNot Nothing ThenorIf Not (listResults is Nothing) ThenorIf Not IsNothing(listResults) Then I made a search that there are a few other places where the <> Nothing was used e.g. If Request.QueryString("Field") <> Nothing then dim r as ......

use VS 2005 or VS 2003 due to VS 2005 slowness?

One reader of my post “How to fix "Visual Studio 2005 is very slow" problem -no solution so far“ asked me should he use VS 2005 or VS 2003: “We recently moved from VB6 environment to .net. We started our project in VS 2005 , asp.2.0 . But the issue is VS 2005 is VERY Slow on our computers. My Team members are getting frustrated. I increased the Ram to 1 GB... still no significant improvement! (yet to implement the hot fix).” I've posted his questions and my answers here: 1) ......

How to refer to parent DataGrid from DataGridItem - use NamingContainer

It's published in a few places, but I had to do a few Google searches before confirming that you should use NamingContainer property to get parent DataGrid for DataGridItem. So I've created a shared method in my WebFormsHelper class. Public Shared Function ParentDataGrid(ByVal Item As DataGridItem) As DataGrid ' Dim gridTable As DataGridTable = Item.Parent 'DataGrid = gridTable.Parent doesn't work because MS declared DataGridTable as private(why?) Dim grid As DataGrid = Item.NamingContainer Return ......

HyperLink for files with spaces in the path not working in Internet Explorer.

I was using asp:hyperlink control to show links to local LAN files , e.g. <asp:HyperLink ID="lnkToClick" runat="server">link to LAN fileasp:HyperLink> Me.lnkToClick.NavigateUrl = “file://\\Server\Folder\Fil... It worked fine, unless Folder path or filename has spaces in it(Probably other special character could cause the same problem). In this case, generated html file has %20 instead of space and clicking on the generated link in IE doesn't open file. In othe words Internet Explorer ......

DotNetNuke: InstallationDate entry in web.Config can be missing.

We had couple sites when during install of DotNetNuke(4.0.3) there was a known "Nothing to Install At This Time" message.I've tried to investigate , how it could happen.At the first installation the function Install.InstallApplication (Install\Install.aspx.vb) checks web.config file.If InstallationDate is missing, it tries to call Config.UpdateMachineKey, which should add InstallationDate element and save web.config.If the save not succced, the “DotNetNuke Configuration Error“ error(403-3.htm) ......

Calling VS 2005 tests from Windows forms test harness

I like VS 2005 Team System ability to generate test cases. Using it with TestDriven.Net “Test with Debugger” allows quickly debug and test a new or existing code. However if you do a relatively long debugger session with multiple edit changes, the test session is often interrupted. I found that “Edit and Continue” for Windows form(or console) application is more stable. So my question was: can I call TestMethod from Windows form test harness? The answer is YES, no problem. You need to add reference ......

Unreadable characters in Web Services string parameter can cause HTTP status 400: Bad Request

I have a web service that sends USMARC record as string. USMARC uses unreadable characters Chr(29)/Chr(30)/Chr(31) as separators. MS web services XMLSerializer doesn't encode these characters and causes System.Net.WebException: "The request failed with HTTP status 400: Bad Request".Interesting to note that the error not happened if test the operation using the HTTP POST protocol or if a string is incorporated into Dataset record.I am using simple Encode/Decode functions to workaround the issue. TODO: ......

Ado.Net 2.0 How SqlCommandBuilder works.

I've debugged my code that uses SqlCommandBuilder: Dim daJoinTable As New SqlDataAdapter(sSQLSelect,c... Dim cbJoinTable As New SqlCommandBuilder(daJoinTable) daJoinTable.Update(dsJoinTa... and noticed that daJoinTable.UpdateCommand,I... and DeleteCommand are nulls, when I expected that they will be generated by SqlCommandBuilder. Even if code works fine, I was curious, how dataadapter knows which update SQL command should be used. I found a good article about SqlCommandBuilder, ......

Thread-safe MessageBox in Windows form

I've used TestEmailer.TestForm from A class for sending emails with attachments in C#. and got an InvalidOperationException that related to How to: Make Thread-Safe Calls to Windows Forms Controls. The following code is how to make event handler safe. private void OnMailSent() { SetStatusBar("Mail sent.");// statusBar.Text = "Mail sent."; //MessageBox.Show(this, "The mail has been sent.", "Mail Sent", MessageBoxButtons.OK, MessageBoxIcon.Information); ShowMessageBox("The mail has been sent.", "Mail ......

«July»
SunMonTueWedThuFriSat
2526272829301
2345678
9101112131415
16171819202122
23242526272829
303112345