Solved

Display as MonthName Day, Year in vb.net

Posted on 2014-03-05
3
169 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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

I think the Typed DataTable and Typed DataSet are very good options when working with data, but I don't like auto-generated code. First, I create an Abstract Class for my DataTables Common Code.  This class Inherits from DataTable. Also, it can …
Microsoft Reports are based on a report definition, which is an XML file that describes data and layout for the report, with a different extension. You can create a client-side report definition language (*.rdlc) file with Visual Studio, and build g…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

707 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

11 Experts available now in Live!

Get 1:1 Help Now