Solved

Display as MonthName Day, Year in vb.net

Posted on 2014-03-05
3
170 Views
Last Modified: 2014-03-06
Hi all.

I have the following code that populates a textbox with the quotedate field from the Select statement

        sda.Fill(ds, "QuoteDate")
        bs = New BindingSource(ds, "QuoteDate")
        DataBindings.Clear()
        frm.txtQuoteDate.DataBindings.Add("Text", bs, "QuoteDate")

Open in new window


Currently it displays it as: 3/05/2014  12:00:00AM

The datatype in the table is: date

I want to be able to display the textbox as: March 5, 2014

Any idea how I can do this?

Thank you in advance.
0
Comment
Question by:printmedia
3 Comments
 
LVL 83

Assisted Solution

by:CodeCruiser
CodeCruiser earned 250 total points
ID: 39907131
One option is to use the Format event of the binding

http://msdn.microsoft.com/en-us/library/system.windows.forms.binding.format.aspx
0
 
LVL 20

Expert Comment

by:ElrondCT
ID: 39907389
Or perhaps bind to a DateTimePicker with format setting of Custom and CustomFormat of "MMMM d, yyyy"
0
 
LVL 27

Accepted Solution

by:
Ark earned 250 total points
ID: 39908744
      Dim b As New Binding("Text", bs, "QuoteDate", True)
        b.FormatString = "MMMM, d, yyyy"
        TextBox1.DataBindings.Add(b)

Open in new window

0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: Kraeven
Introduction Remote Share is a simple remote sharing tool, enabling you to see, add and remove remote or local shares. The application is written in VB.NET targeting the .NET framework 2.0. The source code and the compiled programs have been in…
Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …

895 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now