473,394 Members | 1,755 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Combobox - Format Items

Good Afternoon,

I have a combobox whose list is bound to DataSet1.Sales Growth Options.Sales
Growth. The data is double and I would like it displayed as a percentage. I
have tried two things:

1. I bound the data using DataSource and DisplayMember and then used the
following code:

Private Sub FormatPercent(ByVal sender As Object, ByVal e As ConvertEventArgs)
If TypeOf e.Value Is Double Then
e.Value = CType(e.Value, Double).ToString("p")
End If
End Sub

Private Sub CashFlow1Form_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
AddHandler Me.SalesGrowthCombo.DataBindings("Text").Format, AddressOf
Me.FormatNumberWithDecimals

The result is that the first item in the list was formatted correctly, but
the drop-down list of items when you pressed the arrow wasn't.

2. Then I tried eliminating the DataSource and DisplayMember values and
replacing it with the following:

Private Sub CashFlow1Form_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Dim SalesGrowthItems As New Binding("Text", DataSet1, "Growth Rate
Options.Growth Rate")
Add Handler SalesGrowthItems.Format, AddressOf Me.FormatPercent

This resulted in only one item in my combobox. This one item was formatted.

If anybody could give me assistance, I would appreciate it.

Thanks,

Carrie

Jul 21 '05 #1
0 1071

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Doug | last post by:
This is a repost of an item that I still cannot resolve. I have 3 combo boxes. The first leads to the second to the third. When I have selected a value in the second box, the third box shows...
5
by: Carrie | last post by:
Good Morning, I have a combobox whose list is bound to DataSet1.Sales Growth Options.Sales Growth. The data is double and I would like it displayed as a percentage. I have tried two things: ...
6
by: Matt | last post by:
I'm not entirely sure how to describe this issue. I have a number of ComboBoxes in my application which have their text properties bound to a field in a data set. The items loaded in the ComboBox...
4
by: Jerad Rose | last post by:
I'm baffled by this -- is there not a typed object used for ComboBox Items? Best I can tell, all of the methods for ComboBox that accept an Item are of type Object. Why in the world is a...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.