Solved

How do I Format Data in a Datagridview

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

Forrester Webinar: xMatters Delivers 261% ROI

Guest speaker Dean Davison, Forrester Principal Consultant, explains how a Fortune 500 communication company using xMatters found these results: Achieved a 261% ROI, Experienced $753,280 in net present value benefits over 3 years and Reduced MTTR by 91% for tier 1 incidents.

Question has a verified solution.

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

This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

687 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