I have some textboxes bound to an access db. I wanted to format the
textboxes that displayed currency and date info so I did the following:
Dim WithEvents oBidAmt As Binding
oBidAmt = New Binding("Text", Me.Ds1, "Items.BidA mt")
txtBidAmt.DataB indings.Add(oBi dAmt)
Private Sub oBidAmt_Format( ByVal sender As Object, ByVal e As
System.Windows. Forms.ConvertEv entArgs) Handles oBidAmt.Format
e.Value = Format(e.Value, "c")
End Sub
Private Sub oBidAmt_Parse(B yVal sender As Object, ByVal e As
System.Windows. Forms.ConvertEv entArgs) Handles oBidAmt.Parse
e.Value = Format(e.Value, "D")
End Sub
I am unable to edit the textboxes that are currency formatted. I am able to
edit the textboxes that are date formatted.
When I type a new amount into a textbox with currency formatting it reverts
back to the old amount as soon as I leave the textbox.
The date types do however work as expected.
Any ideas?
Slonocode 3 3083
Slonocode -
The databound textbox is actually throwing an error that you can't catch.
You need to revert the currency back into a format that the db can handle.
(usually accomplished by removing the dollar sign ($, for example))
hope that helps
Steve Stein
VB Team
This posting is provided "AS IS" with no warranties and confers no rights.
--------------------
| From: "Slonocode" <st************ *******@yahoo.c om>
| Newsgroups: microsoft.publi c.dotnet.langua ges.vb
| Subject: Binding, Format, Parse...Not able to edit
| Date: Fri, 16 Jan 2004 19:05:21 -0500
| Lines: 30
| Message-ID: <bu************ @ID-137764.news.uni-berlin.de>
| NNTP-Posting-Host: pcp05008461pcs. sanarb01.mi.com cast.net (68.40.85.170)
| X-Trace: news.uni-berlin.de 1074297930 16380971 68.40.85.170 ([137764])
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2720.3000
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2727.1300
| Path:
cpmsftngxa07.ph x.gbl!cpmsftngx a10.phx.gbl!TK2 MSFTNGXA06.phx. gbl!TK2MSFTNGXA 0
5.phx.gbl!TK2MS FTNGP08.phx.gbl !newsfeed00.sul .t-online.de!newsf eed01.sul.t-o
nline.de!t-online.de!fu-berlin.de!uni-berlin.de!pcp05 008461pcs.sanar b01.mi.c
omcast.NET!not-for-mail
| Xref: cpmsftngxa07.ph x.gbl microsoft.publi c.dotnet.langua ges.vb:173793
| X-Tomcat-NG: microsoft.publi c.dotnet.langua ges.vb
|
| I have some textboxes bound to an access db. I wanted to format the
| textboxes that displayed currency and date info so I did the following:
|
| Dim WithEvents oBidAmt As Binding
| oBidAmt = New Binding("Text", Me.Ds1, "Items.BidA mt")
| txtBidAmt.DataB indings.Add(oBi dAmt)
|
|
| Private Sub oBidAmt_Format( ByVal sender As Object, ByVal e As
| System.Windows. Forms.ConvertEv entArgs) Handles oBidAmt.Format
| e.Value = Format(e.Value, "c")
| End Sub
|
| Private Sub oBidAmt_Parse(B yVal sender As Object, ByVal e As
| System.Windows. Forms.ConvertEv entArgs) Handles oBidAmt.Parse
| e.Value = Format(e.Value, "D")
| End Sub
|
|
|
| I am unable to edit the textboxes that are currency formatted. I am able
to
| edit the textboxes that are date formatted.
| When I type a new amount into a textbox with currency formatting it
reverts
| back to the old amount as soon as I leave the textbox.
| The date types do however work as expected.
|
| Any ideas?
| Slonocode
|
|
|
""Steven Stein [MSFT]"" <ss****@online. microsoft.com> wrote in message
news:Nv******** ******@cpmsftng xa07.phx.gbl... Slonocode -
The databound textbox is actually throwing an error that you can't catch. You need to revert the currency back into a format that the db can handle. (usually accomplished by removing the dollar sign ($, for example))
hope that helps
Steve Stein VB Team
This posting is provided "AS IS" with no warranties and confers no rights.
I thought I was converting back to decimal with the Parse event. Am I using
the Parse/Format correctly? Do I have to manually remove the "$"?
Private Sub oBidAmt_Format( ByVal sender As Object, ByVal e As
System.Windows. Forms.ConvertEv entArgs) Handles oBidAmt.Format
e.Value = Format(e.Value, "c")
End Sub
Private Sub oBidAmt_Parse(B yVal sender As Object, ByVal e As
System.Windows. Forms.ConvertEv entArgs) Handles oBidAmt.Parse
e.Value = Format(e.Value, "D")
End Sub
Slonocode
You are correct. You need to convert back to decimal from the currency
string in the parse event. Here's a code snippet from the Binding.Parse
topic http://msdn.microsoft.com/library/en...windowsformsbi
ndingclassparse topic.asp
Private Sub CurrencyStringT oDecimal(sender As Object, cevent As
ConvertEventArg s)
' The method converts back to decimal type only.
If Not cevent.DesiredT ype Is GetType(Decimal ) Then
Exit Sub
End If
' Convert the string back to decimal using the shared Parse method.
cevent.Value = Decimal.Parse(c event.Value.ToS tring, _
NumberStyles.Cu rrency, nothing)
End Sub
hope that helps
Steve Stein
VB Team
This posting is provided "AS IS" with no warranties and confers no rights.
-------------------- From: "Slonocode" <su**********@s pamsux.net> Newsgroups: microsoft.publi c.dotnet.langua ges.vb Subject: Re: Binding, Format, Parse...Not able to edit Date: Tue, 20 Jan 2004 20:41:20 -0500 Lines: 32 Message-ID: <bu************ @ID-137764.news.uni-berlin.de> References: <bu************ @ID-137764.news.uni-berlin.de>
<Nv************ **@cpmsftngxa07 .phx.gbl>NNTP-Posting-Host: pcp05008461pcs. sanarb01.mi.com cast.net (68.40.85.170) X-Trace: news.uni-berlin.de 1074649287 19687756 68.40.85.170 ([137764]) X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2720.3000 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2727.1300 Path:
cpmsftngxa07.ph x.gbl!cpmsftngx a06.phx.gbl!TK2 MSFTNGP08.phx.g bl!newsfeed00.s u
l.t-online.de!newsf eed01.sul.t-online.de!t-online.de!fu-berlin.de!uni-berlin
.de!pcp05008461 pcs.sanarb01.mi .comcast.NET!no t-for-mailXref: cpmsftngxa07.ph x.gbl microsoft.publi c.dotnet.langua ges.vb:174695 X-Tomcat-NG: microsoft.publi c.dotnet.langua ges.vb
""Steven Stein [MSFT]"" <ss****@online. microsoft.com> wrote in message news:Nv******* *******@cpmsftn gxa07.phx.gbl.. . Slonocode -
The databound textbox is actually throwing an error that you can't catch. You need to revert the currency back into a format that the db can
handle. (usually accomplished by removing the dollar sign ($, for example))
hope that helps
Steve Stein VB Team
This posting is provided "AS IS" with no warranties and confers no
rights. I thought I was converting back to decimal with the Parse event. Am I
usingthe Parse/Format correctly? Do I have to manually remove the "$"?
Private Sub oBidAmt_Format( ByVal sender As Object, ByVal e As System.Windows .Forms.ConvertE ventArgs) Handles oBidAmt.Format e.Value = Format(e.Value, "c") End Sub
Private Sub oBidAmt_Parse(B yVal sender As Object, ByVal e As System.Windows .Forms.ConvertE ventArgs) Handles oBidAmt.Parse e.Value = Format(e.Value, "D") End Sub This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Saix News |
last post by:
hi,
i have a dataset and a number of controls that are bound to it.
some of the records being displayed are numerical and are bound to text
boxes. they display without a problem but i would like to be able to format
the numbers being displayed using thousand separators, etc. could someone
please point me in the right direction as to how to do this - i have not
been able to find a way of doing this.
|
by: Jesse |
last post by:
Hi All,
I've been working on a form that has several bound
controls that all link to one table in a dataset. In the
table, there is a column for the filename of jpeg images
related to each record. I have a combobox which displays
the key for each record so that the user can select an
item and all the other controls update. So far i have
the combobox, a label and a textbox all bound and working
correctly when a user selects an item. ...
|
by: Marina |
last post by:
Hi,
I have a text control bound to a column that is of type Decimal. I am doing
the validation myself to see if the user typed in something invalid, calling
CancelCurrentEdit and cancelling the validation event.
If the user typed in something that is not a number, such as 'abc', then
doing this works. The old value stored in the data source is popped into the
control.
|
by: Richard Urwin |
last post by:
I'm using C# and having problems getting the 'Parse' EventHandler of
my binding object to be called. Interestingly, the 'Format' method is
always called however. A code snippet:
(rdDocument is a private member field of the class and has a
string-type property called 'Name')
Binding bName = new Binding("Text", rdDocument, "Name");
bName.Format += new ConvertEventHandler(teName_Format);
bName.Parse += new...
|
by: Johnaton |
last post by:
hi, I have this problem with the date time picker, when I bind the control
to data table and add new record, it is ok, however, if I delete all records
via a button using the
me.bindingcontext(datatable).removeat(me.bindingcontext(dataTable).position)
statement, it always throw the following error ..
A first chance exception of type 'System.ArgumentException' occurred in
system.dll
| |
by: David Veeneman |
last post by:
I want to data bind a user control and a business object, using a
BindingSource control. The control has a 'Priority' property that takes a
'Priority' enum (High, Normal, Low). The business object has a property with
the same name, which takes an identical enum.
Data binding isn't working, and I think it's because the two enums are
different. Even though they have the same name and the same elements, they
are declared under different...
|
by: Sam |
last post by:
I am trying to use a Simple form with 3 fields from SQL NorthWind
Database (Order Details Table with 3 Fields. - OrderId, ProductId and
Unit Price). The Field Unit Price has a data type of 'Money Type'.
All I want is to able to edit/view/insert 'UnitPrice' field with 2
decimal points instead of 4 decimal points.
If I use: Bind("UnitPrice", "{0:c}") in Edit Template, I got: "Input
string was not in a correct format...". Although this...
|
by: Sam |
last post by:
Folks..
I am trying to use a Simple form with 3 fields from SQL NorthWind
Database (Order Details Table with 3 Fields. - OrderId, ProductId and
Unit Price). The Field Unit Price has a data type of 'Money Type'.
All I want is to able to edit/view/insert 'UnitPrice' field with 2
decimal points instead of 4 decimal points.
|
by: Earl |
last post by:
I'm adding password encryption to the Employees form. I have a
strongly-typed dataset being used as the datasource for the
EmployeesBindingSource, and the Employees table set as the datamember. All
controls on the form are bound to the EmployeesBindingSource. Except for the
password ...
I set up separate handlers for the Password and bind this control manually
when I New() the form:
Private Sub BindPasswordControl()
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
| |
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| | |