SpriteHand
Module Border
  Andy's Blog
Module Border
Author: host Created: 3/6/2006 9:55 PM
Adventures in .NET

GridView DataFormatString
By Andy Beaulieu on 1/26/2006 10:46 AM
Here's some fun with the ASP.NET 2.0 GridView... I'm generally more of a templated column kinda guy, but I was feeling lazy and tried to format a BoundColumn as Currency using

DataFormatString="{0:c}"


 ... simple enough, right? Then why doesn't it work?! Turns out you have to set the HtmlEncode attribute to False in order for the DataFormatString to take...
 

<asp:BoundField DataField="Amount" HeaderText="Amount" ReadOnly="True" SortExpression="Amount" DataFormatString="{0:c}" HtmlEncode="False" />

Comments (2)

DAL Generation and ORM tools
By Andy Beaulieu on 1/26/2006 10:23 AM
I am trying to compile a list of Data Access Layer code generators and ORM mapping tools...
 
 
 
 
 
... and I found an OR Tool comparison for several here -
Comments (1)

ReportViewer control - programmatically
By Andy Beaulieu on 1/26/2006 9:08 AM
In VS2005, the report designer is great for quickly throwing together a report and binding it to an ObjectDataSource... but what if you want to do this through code for more control?
 
The steps are to create the report _without_ using a TableAdapter, and then manually create the data source through code (below). Note that the "rds.Name" property must be set to the "DataSetName" attribute in the report's RSDL file:
         <DataSetName>DSCustomers_OutCustomersDataSetName>

Dim dsCustomers As DSCustomers
Dim oCustomers As New CCustomers()

dsCustomers = oCustomers.GetCustomers()
Dim rds As ReportDataSource = New ReportDataSource
ReportViewer1.LocalReport.DataSources.Clear()
rds.Name =
"DSCustomers_OutCustomers"
rds.Value = dsCustomers.OutCustomers
ReportViewer1.LocalReport.DataSources.Add(rds)
ReportViewer1.DataBind()


As a second example, let's say you use a Typed DataSet and TableAdapter as a Data Source and you are creating a WindowsForms application. In the example below, a Typed DataSet has been created called "DataSet1" which queries the Customers table.

Some important things to remember:

  • you need to call  the Reset() method on the ReportViewer whenever you dynamically switch reports.
  • you need to prefix report (RDLC) filenames with the Namespace of the project the report is in (below the namespace is "ReportViewerTest.")

reportViewer1.Reset();

DataSet1TableAdapters.CustomersTableAdapter ta1 = new DataSet1TableAdapters.CustomersTableAdapter();

DataSet1.CustomersDataTable dt1 = new DataSet1.CustomersDataTable();

ta1.Fill(dt1);

 

ReportDataSource rds = new ReportDataSource();

reportViewer1.LocalReport.DataSources.Clear();

reportViewer1.LocalReport.ReportEmbeddedResource = "ReportViewerTest.Report1.rdlc";

rds.Name = "DataSet1_Customers";

rds.Value = dt1;

reportViewer1.LocalReport.DataSources.Add(rds);

reportViewer1.RefreshReport();

 

 

 

Comments (5)

COM+ and MSDTC hosed
By Andy Beaulieu on 1/23/2006 11:18 AM
The last couple of weeks have presented some freaky problems on my end. I had a development workstation that had a hosed COM+ install (when you try to navigate to COM+/My Computer/COM+ Applications it would give an error like "An error occured while processing the last operation.  Error code 80080005 -
Server execution failed."
 
After many attempts at re-installing stuff, this seemed to work for me:
 
(1) follow steps in KB315296 Clean up damaged COM+ catalog
http://support.microsoft.com/?id=315296

(2) reinstall MSDTC
     cd %systemroot%\system32
     msdtc -uninstall
     msdtc -install
Comments (0)

Frustrating VS2005 bug
By Andy Beaulieu on 1/16/2006 8:11 PM
I got caught with this bug back when I was playing with betas long ago... But it recently bit me again on a fresh machine with RTM VS2005 (no betas or RC's installed prior)...
 
When in the editor, the carriage return, delete, backspace and Edit/Cut/Copy/Paste stop functioning. Something about the toolbox windows getting focus hosed up I guess... Anyway, after trying a bunch of IDE Resets and User Settings Import/Export, this finally did it for me... Had to delete default.vsk from Docs and Settings, as this article details:
 
Comments (0)

Mimicking a Data Repeater Control in WinForms
By Andy Beaulieu on 1/4/2006 8:03 PM
VB6 had the cool Data Repeater which allowed you to create an ActiveX control and databind it so that it would show an instance of the user control for each row in your record set.
 
This cool control is missing from .NET, but it's pretty easy to mimick this functionality. Just create a Panel, set its AutoScroll property to True, and use the Controls collection to dynamically add instances of the user control. You will need to also track the Y Offset of each control you add to push down each instance.
 

Dim m_YOffSet As Integer = 0

Public Sub AddAddress(ByVal AddressId As Integer)
    Dim ucAddress1 As New ucAddress
    ucAddress1.Address = "123 University Lane"
    Panel1.Controls.Add(ucAddress1)
    ucAddress1.Visible = True
    ucAddress1.Top = m_YOffSet
    m_YOffSet += ucAddress1.Height
End Sub

Comments (0)

CBIT 2373 Class Notes
By Andy Beaulieu on 11/16/2005 8:58 PM

Here are some notes for the CBIT 2373 class on handling multiple click events in one event handler -

Private m_nFirstValue As Decimal = -1
Private m_nSecondValue As Decimal = -1

Private Sub ButtonAny_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click, Button2.Click, Button3.Click, Button4.Click, Button5.Click, Button6.Click, Button7.Click, Button8.Click, Button9.Click, Button12.Click
     
txtResult.Text &= CType(sender, Button).Text
End Sub

Private Sub btnPlus_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnPlus.Click
     
m_nFirstValue = CType(txtResult.Text, Decimal)
      txtResult.Text = ""
End Sub

Private Sub btnEquals_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnEquals.Click
     
m_nSecondValue = CType(txtResult.Text, Decimal)
     
txtResult.Text = m_nFirstValue + m_nSecondValue
End Sub

Private Sub btnClear_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClear.Click
     
txtResult.Text = ""
     
m_nFirstValue = -1
     
m_nSecondValue = -1
End Sub

Comments (0)

VS2005 TableAdapters Article
By Andy Beaulieu on 11/11/2005 5:17 PM

I have finally posted up an article I wrote on extending the new VS2005 TableAdapters into a multi-tier architecture. It is quite lengthy and shows one way of leveraging the new TableAdapter/DataSet designer in a 3-tier architecture that supports both WinForms and ASP.NET 2.0... Note that if you are creating only a WinForms client, you may want to instead just use the RowChanged event in the DataSet to do your validation, but that does not lend itself to a web environment. I subsequently did a presentation for our CNY Developer Group this month on the contents of this article.

Comments (0)

VS2005 N-Tier Dev Article
By Andy Beaulieu on 11/11/2005 5:17 PM

I have finally posted up an article I wrote on extending the new VS2005 TableAdapters into a multi-tier architecture. It is quite lengthy and shows one way of leveraging the new TableAdapter/DataSet designer in a 3-tier architecture that supports both WinForms and ASP.NET 2.0... Note that if you are creating only a WinForms client, you may want to instead just use the RowChanged event in the DataSet to do your validation, but that does not lend itself to a web environment. I subsequently did a presentation for our CNY Developer Group this month on the contents of this article.

Comments (2)

Julie Lerman visits CNY Developers!
By Andy Beaulieu on 10/6/2005 5:55 AM
Julie Lerman was kind enough to pay our CNY Developer Group a visit last night, and gave her “What's New in ADO.NET 2.0” talk. Great presentation of course, and Julie is obviously one of those speakers who is really into the technology. Julie had so much new stuff to share, I think we could have easily gone for an 8 hour session instead of a couple of hours!
Comments (0)

Module Border Module Border
Module Border
  Subscribe
Module Border
RSS   Twitter
Module Border Module Border
Module Border
  Diversions
Module Border


PHYSAMAJIG
This Windows app was created using Physics Helper XAML, and the Farseer Physics Engine.
DOWNLOAD

MORE INFO



TALKING RAGDOLL
This Windows Phone app was created using Silverlight, the  Physics Helper Library,  and the Farseer Physics Engine. It gets interesting when you import your friends photos and have your way with them!

MORE INFO



BOSS LAUNCH
This physics game won first place in the Server Quest Contest. Created using Silverlight , the Physics Helper Library,  and the Farseer Physics Engine.
PLAY IT

MORE INFO



DESTROY ALL INVADERS
A scrolling shooter game where the objective is to destroy the invading UFO's flying over a neighborhood of your choosing. Imagery provided by Microsoft Virtual Earth. Created using Silverlight.
PLAY IT

INFO AND CODE



PHYSICS HELPER DEMOS
These demos were created for the Physics Helper Library, which makes it easy to create physics games and simulations using Expression Blend, Silverlight, and the Farseer Physics Engine.
PLAY IT

INFO AND CODE



HOOK SHOT
This little basketball game took first place in the TeamZoneSports Silverlight Contest. Created using Silverlight and the Farseer Physics engine.
PLAY IT

MORE INFO



SORT THE FOOBARS
A game where you need to sort the good foobars from the bad ones. Created using Silverlight and the Farseer Physics engine.
PLAY IT

MORE INFO



POLYGON PHYSICS DEMO
A demo showing polygon physics where the user draws physics objects with the mouse. Created using Silverlight and the Farseer Physics engine.
PLAY IT

MORE INFO



SILVERLIGHT ROCKS!
Destroy the asteroids before they destroy your ship! Created using Silverlight.
PLAY IT

INFO AND CODE



FISH GAME
A simple game of harpoon-the-fish. Written using the AJAX Sprite Toolkit.
PLAY IT

INFO AND CODE

Module Border Module Border
Module Border
  Search_Blog
Module Border
Module Border Module Border
Module Border
  Blog_Archive
Module Border
Module Border Module Border
Copyright (c) 2014 andy.beaulieu.com - Login
cheap Ralph Lauren shirts Ralph Lauren outlet Canada Goose jackets on sale cheap moncler jackets moncler jackets on sale moncler outlet canada goose outlet canada goose outlet canada goose outlet cheap ralph lauren shirts ralph lauren outlet ralph lauren outlet canada goose outlet canada goose outlet kanye west louis vuitton moncler outlet moncler outlet moncler outlet moncler outlet speedy louis vuitton canada goose outlet moncler outlet tiffany outlet moncler outlet speedy louis vuitton kanye west louis vuitton