显示今天的日期并计算DataGridView中的列 [英] Display todays date and calculate columns in a DataGridView

查看:135
本文介绍了显示今天的日期并计算DataGridView中的列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请提供以下代码来帮助我,我希望datagridview中的一列显示今天的日期.还要计算今天日期的所有行费用,并将其显示在文本框中.

Please can somebody help me with the code below, I would like a column in my datagridview to display todays date. Also to caluclate all the row charges of todays date and display them in a text box. 

谢谢

Private Sub Rental_ItemDataGridView_CellFormatting(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellFormattingEventArgs) Handles Rental_ItemDataGridView.CellFormatting

    If e.ColumnIndex = 4 Then
      Dim rental_date As Date = Date.Today

    End If

  End Sub

Private Sub Rental_ItemDataGridView_SelectionChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles Rental_ItemDataGridView.SelectionChanged

dim cell as datagridviewcell
 dim rental charge as currency
  cell = row.cell(8)
   if ISDBNull (cell.value) Then
      rental_charge = 0 

      else
       rental_charge = CInt(cell)

      End if
      totalCharge +=rental_charge
next 
textBox2.text = totalcharge.tostring

推荐答案

您想在哪里显示日期?

Where do you want to displaythe date?

可以吗?

1.发布用于填充datagridview的查询

1. Post the query with which you fill the datagridview

2.清楚说明您要做什么?

2. Explain clearly what you want to do?


这篇关于显示今天的日期并计算DataGridView中的列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆