Solved

Display as MonthName Day, Year in vb.net

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

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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

It’s quite interesting for me as I worked with Excel using vb.net for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

685 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