Solved

How do I Format Data in a Datagridview

Posted on 2009-04-11
1
179 Views
Last Modified: 2013-12-25
I Have an App (VB.Net) where data is extracted from a DB and presented in a DataGridView as a dataset.

I would like to format the column titled "Split" in the format as 0.23, 0.25 etc.

I am new to programing and having a tough time figuring thing out.

Thanks

Public Class Agents

 

    

    Private Sub Agents_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        'TODO: This line of code loads data into the 'AgentsDataSet.Agents' table. You can move, or remove it, as needed.

        Me.AgentsTableAdapter.Fill(Me.AgentsDataSet.Agents)

        'Change the sort order

 

    End Sub

 

    Private Sub AgentsBindingNavigatorSaveItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AgentsBindingNavigatorSaveItem.Click

        Me.Validate()

        Me.AgentsBindingSource.EndEdit()

        Me.TableAdapterManager.UpdateAll(Me.AgentsDataSet)

        Me.Close()

    End Sub

 

    

End Class

Open in new window

0
Comment
Question by:Max1565
1 Comment
 
LVL 10

Accepted Solution

by:
Espavo earned 50 total points
ID: 24124669
You haven't dropped the DataGrid here... so I don't see your "Split" column...
The way to do it would be to change your <%# Bind("Split") %> to <%# Format(Eval("Split"), "0.00") %>
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

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

910 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

21 Experts available now in Live!

Get 1:1 Help Now