Display as MonthName Day, Year in vb.net

printmedia
printmedia used Ask the Experts™
on
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.
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Most Valuable Expert 2012
Top Expert 2014
Commented:
One option is to use the Format event of the binding

http://msdn.microsoft.com/en-us/library/system.windows.forms.binding.format.aspx
Or perhaps bind to a DateTimePicker with format setting of Custom and CustomFormat of "MMMM d, yyyy"
      Dim b As New Binding("Text", bs, "QuoteDate", True)
        b.FormatString = "MMMM, d, yyyy"
        TextBox1.DataBindings.Add(b)

Open in new window

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial