Solved

How do I Format Data in a Datagridview

Posted on 2009-04-11
1
200 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

How our DevOps Teams Maximize Uptime

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us. Read the use case whitepaper.

Question has a verified solution.

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

Suggested Solutions

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

679 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