Solved

Display as MonthName Day, Year in vb.net

Posted on 2014-03-05
3
175 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
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…
Come and listen to Percona CEO Peter Zaitsev discuss what’s new in Percona open source software, including Percona Server for MySQL (https://www.percona.com/software/mysql-database/percona-server) and MongoDB (https://www.percona.com/software/mongo-…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

696 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