StrataFrame Forum
Home      Members   Calendar   Who's On
Welcome Guest ( Login | Register )
      



Grid column formattingExpand / Collapse
Author
Message
Posted 07/03/2006 10:36:01 AM


StrataFrame User

StrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame User

Group: StrataFrame Users
Last Login: Today @ 6:18:33 PM
Posts: 329, Visits: 480
I am using the Inherited UI controls, particularly the Enhanced List.  Is there a  way to format a boolean to show up in the column as Yes/No instead of True/False?  Also, I am having trouble formatting a date column.  I want it to be 07/03/2006, but instead it is showing up as 07/03/2006 12:00:00 AM.  I have DateTime selected as FormatType and 'd' as FormatString.  Should I be doing something else?
Post #1712
Posted 07/03/2006 12:48:58 PM


StrataFrame Developer

StrataFrame Developer

Group: StrataFrame Developers
Last Login: 12/09/2008 3:36:08 PM
Posts: 2,686, Visits: 1,891
On the True/False options, you can configure the column to PopulateThroughEvent rather than FormattedString and set the actual value within the RowPopulating event of the EnhancedList.  So, rather than setting the display format to "{3}" (or whatever the column index is), you go to the RowPopulating event and set the value within it like so:

If CType(e.BusinessObject, MyBoType).TestValue Then
    e.Values(3).DisplayValue = "Yes"
Else
    e.Values(3).DisplayValue = "No"
End If

As for the datetime formatting issue, you're best bet is going to be to leave the column's type as a string and change the "{2}" to "{2:d}".  You can add whatever formatting specifier is necessary after the :  So, if you need to format a number with a comma in the thousand's place, it would be "{2:n3}".  You can find more information by searching for String.Format() in the Visual Studio help.  My link to the document is:

ms-help://MS.VSCC.v80/MS.MSDN.v80/MS.VisualStudio.v80.en/dv_csref/html/120ba537-4448-4c62-8676-7a8fdd98f496.htm  (open up your VS help and paste that into the URL blank)


www.bungie.net
Post #1713
Posted 07/03/2006 3:11:03 PM


StrataFrame User

StrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame User

Group: StrataFrame Users
Last Login: Today @ 6:18:33 PM
Posts: 329, Visits: 480
Great, that works perfectly.  One more along those same lines...

I have an enum like the following:

Public Enum VerifyCode
  OkToApprove
  CannotApprove
  AERequired
End Enum

I want to use this enum to populate a combo, which I know how to do.  I also set the PascalCase to true, so they show up correctly.  I get "Ok To Approve" and Cannot Approve", but I want the last one to show up as "A/E Required".  Is there anyway to override the display value for only one enum value like this?


 

Post #1714
Posted 07/03/2006 4:21:38 PM


StrataFrame Developer

StrataFrame Developer

Group: StrataFrame Developers
Last Login: 12/09/2008 3:36:08 PM
Posts: 2,686, Visits: 1,891
No, there isn't a way to do that for only one enum value.  The only thing you might try is to add the AERequired to the EnumItemsToOmit property and add a TopMostItem of AERequired.  Then, it will effectively remove the AERequired from the "enums" portion of the list and re-add it to the top of the list through the TopMostItem.  That's the only way I can think to do it.

You can always handle the ParentFormLoading event of the combo because that event fires directly after it has been populated with the enum.  Then, you could alter the data within the combo's DataSource property, which comes out as a DataTable with two columns, one for display, one for the value behind.  You would just need to modify the display value... However, this method gets a little nitty gritty, so don't blow your fingers off


www.bungie.net
Post #1715
« Prev Topic | Next Topic »


Reading This TopicExpand / Collapse
Active Users: 0 (0 guests, 0 members, 0 anonymous members)
No members currently viewing this topic.
Forum Moderators: Ben Chase, Trent L. Taylor, Steve L. Taylor

PermissionsExpand / Collapse

All times are GMT -6:00, Time now is 8:54pm

Powered by InstantForum.NET v4.1.4 © 2009
Execution: 0.125. 10 queries. Compression Enabled.
Site Map - Home - My Account - Forum - About Us - Contact Us - Try It - Buy It

Microsoft, Visual Studio, and the Visual Studio logo are trademarks or registered trademarks of Microsoft Corporation in the United States and/or other countries.