Public Class ModifyLineData

    Dim mousePos As Point
Dim pubListviewitem As ListViewItem
Dim imgList As ImageList
Dim pubParent As FrmInvoiceList
Public Sub InitDataLine(ByVal dr As IDataReader, ByVal argTaxTypeStr As String, ByVal tax_rate As String, ByRef argParentForm As FrmInvoiceList)
pubParent = argParentForm Dim listviewitem As ListViewItem ListView1.Items.Clear()
ListView1.View = View.Details While dr.Read()
listviewitem = New ListViewItem listviewitem.Text = dr("list_goods_name").ToString() '"" 'listviewitem.SubItems.Add(dr("list_goods_name").ToString())
listviewitem.SubItems.Add(dr("list_tax_item").ToString())
listviewitem.SubItems.Add(dr("list_standard").ToString())
listviewitem.SubItems.Add(dr("list_unit").ToString())
listviewitem.SubItems.Add(dr("list_number").ToString())
listviewitem.SubItems.Add(dr("list_price").ToString())
listviewitem.SubItems.Add(dr("list_price_kind").ToString())
'listviewitem.SubItems.Add(dr("list_goods_name").ToString())
listviewitem.SubItems.Add(argTaxTypeStr)
listviewitem.SubItems.Add(tax_rate) ListView1.Items.Add(listviewitem) End While dr.Close() End Sub Private Sub ModifyLineData_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load 'Common.DisableCloseButton(Me) mousePos = New Point(0, 0) imgList = New ImageList()
imgList.ImageSize = New Size(1, 20)
ListView1.SmallImageList = imgList
ListView1.GridLines = True
ListView1.Controls.Add(ComboBox1) 'ListView1.View = View.Details
'ListView1.Items.Clear()
'inittest() Dim tmpDt As DataTable = New DataTable tmpDt = ExcelHelper.ImportExcel(Application.StartupPath + "\InvoiceType.xls") ComboBox1.Items.Clear() For i As Int32 = 0 To tmpDt.Rows.Count - 1 ComboBox1.Items.Add(tmpDt.Rows(i)("税收编码") + "||" + tmpDt.Rows(i)("商品和服务名称")) Next End Sub Private Sub ListView1_MouseMove(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles ListView1.MouseMove mousePos.X = e.X
mousePos.Y = e.Y End Sub Private Sub ListView1_MouseDoubleClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles ListView1.MouseDoubleClick pubListviewitem = ListView1.GetItemAt(mousePos.X, mousePos.Y) ComboBox1.Text = pubListviewitem.SubItems(1).Text ComboBox1.Width = ListView1.Columns(1).Width
ComboBox1.Height = imgList.ImageSize.Height ComboBox1.Location = New Point(pubListviewitem.Position.X + ListView1.Columns(0).Width, pubListviewitem.Position.Y)
ComboBox1.Visible = True End Sub Private Sub ComboBox1_SelectedValueChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedValueChanged changeName() End Sub Private Sub changeName() ComboBox1.Text = ComboBox1.Text.Split("||")(0)
For Each item As ListViewItem In ListView1.SelectedItems
item.SubItems(1).Text = ComboBox1.Text
'pubListviewitem.Text = ComboBox1.Text
'pubListviewitem.SubItems(1).Text = pubListviewitem.Text + pubListviewitem.SubItems(8).Text
ComboBox1.Visible = False
Next End Sub Private Sub ListView1_AfterLabelEdit(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LabelEditEventArgs) Handles ListView1.AfterLabelEdit
'pubListviewitem.SubItems(1).Text = pubListviewitem.Text + pubListviewitem.SubItems(8).Text
End Sub Private Sub ButtonConfirm_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonYes.Click Me.ButtonYes.DialogResult = DialogResult.No Dim listPriceKind As Integer ' Dim listNumber As Integer
Dim listNumber As System.Decimal
Dim listPrice As System.Decimal
'Dim taxOffPrice As System.Decimal
Dim taxOffAmount As System.Decimal
Dim totalAmount As System.Decimal
Dim tax_rate As Integer '税收分类编码需要的变量
'Dim contractAttr As String = ""
Dim taxTypeStr As String
Dim taxResStr As String = "" For Each item As ListViewItem In ListView1.Items Me.ButtonYes.DialogResult = DialogResult.Yes Call pubParent.mObjTaxCardX.InvListInit() taxTypeStr = item.SubItems(7).Text pubParent.mObjTaxCardX.ListGoodsName = item.SubItems(0).Text pubParent.mObjTaxCardX.ListTaxItem = item.SubItems(1).Text
pubParent.mObjTaxCardX.ListStandard = item.SubItems(2).Text
pubParent.mObjTaxCardX.ListUnit = item.SubItems(3).Text listNumber = System.Decimal.Parse(item.SubItems(4).Text)
'listNumber = CInt(dr("list_number"))
listPrice = System.Decimal.Parse(item.SubItems(5).Text)
totalAmount = Decimal.Round(Decimal.Multiply(listPrice, listNumber), 2) pubParent.mObjTaxCardX.ListNumber = listNumber listPriceKind = CInt(item.SubItems(6).Text)
If listPriceKind = 1 Then
'taxOffPrice = Decimal.Divide(Decimal.Truncate(Decimal.Divide(listPrice, 0.0117)), 100)
'taxOffPrice = Decimal.Divide(listPrice, 1.17)
tax_rate = CInt(item.SubItems(8).Text)
Dim tax_rate_pre As Decimal = 1 + tax_rate * 0.01
taxOffAmount = Decimal.Round(Decimal.Divide(totalAmount, tax_rate_pre), 2)
listPriceKind = 0
Else
listPriceKind = 0
End If 'mObjTaxCardX.ListPrice = Decimal.ToDouble(taxOffPrice)
'mObjTaxCardX.ListAmount = Decimal.ToDouble(Decimal.Multiply(taxOffPrice, listNumber))
'mObjTaxCardX.ListTaxAmount = Decimal.ToDouble(Decimal.Multiply(Decimal.Subtract(listPrice, taxOffPrice), listNumber))
pubParent.mObjTaxCardX.ListAmount = taxOffAmount
pubParent.mObjTaxCardX.ListTaxAmount = Decimal.Subtract(totalAmount, taxOffAmount) 'MessageBox.Show( String.Format("listPrice:{0},listNumber:{1},totalAmount:{2},taxOffAmount:{3}, taxOffAmount:{4}", listPrice, listNumber, totalAmount, taxOffAmount, Decimal.Subtract(totalAmount, taxOffAmount))) '将税收分类编码通过BatchUpload传递过去。taxResStr是接收的返回结果,有问题,调试可用来看
taxResStr = pubParent.mObjTaxCardX.BatchUpload(taxTypeStr) Call pubParent.mObjTaxCardX.AddInvList() Next Close() End Sub Private Sub ButtonClose_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonNo.Click Me.ButtonYes.DialogResult = DialogResult.No
Close() End Sub Private Sub ComboBox1_Leave(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox1.Leave
changeName()
End Sub Private Sub ModifyLineData_FormClosing(ByVal sender As System.Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles MyBase.FormClosing
Return
End Sub Private Sub inittest()
Dim listviewitem As ListViewItem listviewitem = New ListViewItem
listviewitem.Text = "数字化校园电子设备"
'listviewitem.SubItems.Add("")
listviewitem.SubItems.Add("")
listviewitem.SubItems.Add("")
listviewitem.SubItems.Add("套")
listviewitem.SubItems.Add("1")
listviewitem.SubItems.Add("1800000")
listviewitem.SubItems.Add("1")
listviewitem.SubItems.Add("txt")
'listviewitem.SubItems.Add("数字化校园电子设备")
ListView1.Items.Add(listviewitem) listviewitem = New ListViewItem
listviewitem.Text = "数字化校园电子设备"
'listviewitem.SubItems.Add("")
listviewitem.SubItems.Add("")
listviewitem.SubItems.Add("")
listviewitem.SubItems.Add("套")
listviewitem.SubItems.Add("1")
listviewitem.SubItems.Add("1800000")
listviewitem.SubItems.Add("1")
listviewitem.SubItems.Add("txt")
'listviewitem.SubItems.Add("数字化校园电子设备") ListView1.Items.Add(listviewitem)
End Sub Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
'Panel1.Controls.Add(ComboBox1)
Try
If ListView1.SelectedItems.Count > 0 Then ComboBox1.Width = ListView1.Columns(1).Width
ComboBox1.Height = imgList.ImageSize.Height ComboBox1.Location = New Point(ListView1.SelectedItems(0).Position.X +
ListView1.Columns(0).Width, ListView1.SelectedItems(0).Position.Y)
ComboBox1.Visible = True End If
Catch ex As Exception
MessageBox.Show(ex.Message) End Try End Sub Private Sub ListView1_Validated(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ListView1.Validated Try
For Each item As ListViewItem In ListView1.SelectedItems
If Not item Is Nothing Then
item.BackColor = SystemColors.Highlight
item.ForeColor = Color.White
'ListView1.SelectedIndices.Add(item.Index)
End If
Next
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try End Sub Private Sub ListView1_ItemSelectionChanged(ByVal sender As System.Object, ByVal e As System.Windows.Forms.ListViewItemSelectionChangedEventArgs) Handles ListView1.ItemSelectionChanged
Try
For Each item As ListViewItem In ListView1.Items
item.ForeColor = Color.Black
item.BackColor = SystemColors.Window
Next
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try 'e.Item.ForeColor = Color.Black
'e.Item.BackColor = SystemColors.Window 'If Not ListView1.FocusedItem Is Nothing Then
' ListView1.FocusedItem.Selected = True
'End If End Sub End Class

vb.net 中 listview 中编辑 可以用 ComboBox 选择编辑数据的更多相关文章

  1. 安卓中listview中性能优化的处理

    1.在adapter中的getView方法中尽量少使用逻辑 不要在你的getView()中写过多的逻辑代码,我们能够将这些代码放在别的地方.比如: 优化前的getView(): @Override p ...

  2. 我的Android进阶之旅------>Android中ListView中嵌套(ListView)控件时item的点击事件不起作的问题解决方法

    开发中常常需要自己定义Listview,去继承BaseAdapter,在adapter中按照需求进行编写,问题就出现了,可能会发生点击每一个item的时候没有反应,无法获取的焦点. 如果你的自定义Li ...

  3. 我的Android进阶之旅------>Android中ListView中嵌套(ListView)控件时item的点击事件不起作的问题解决方法

    watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvb3V5YW5nX3Blbmc=/font/5a6L5L2T/fontsize/400/fill/I0JBQk ...

  4. C#winform中ListView的使用

    使用ListView模仿Windows系统的资源管理器界面,实现文件(夹)的浏览.重命名.删除及查询等功能,主要功能界面展示如下: 1.MainForm.cs及MainForm.Designer.cs ...

  5. BaseAdapter&ArrayAdapter在ListView中应用

    一:BaseAdapter:共同实现的基类的适配器,是ArrayAdapter SimpleAdapter等的父类, 一般用于比较复杂的ListView,扩展性强. 详细信息可查看谷歌官方API:ht ...

  6. 【2017-04--28】Winform中ListView控件

    ListView 1.先设置列,设置视图属性选择Details. 添加列,修改列名. 2.编辑项(添加行数据) 添加一个ListViewItem对象,该对象的Text对应着是第一列的数据, 在该对象的 ...

  7. Delphi在Listview中加入Edit控件

    原帖 : http://www.cnblogs.com/hssbsw/archive/2012/06/03/2533092.html Listview是一个非常有用的控件,我们常常将大量的数据(如数据 ...

  8. Android中ListView实现图文并列并且自定义分割线(完善仿微信APP)

    昨天的(今天凌晨)的博文<Android中Fragment和ViewPager那点事儿>中,我们通过使用Fragment和ViewPager模仿实现了微信的布局框架.今天我们来通过使用Li ...

  9. ListView中的setOnScrollListener

    ListView是Android中最常用的控件之一,随着时代发展,RecyclerView有取代它的趋势,但是在一些老代码中,ListView依然扮演着重要的作用.项目中遇到一个需求,需要监听List ...

随机推荐

  1. 64位windows下mysql安装

    登入mysql官网https://www.mysql.com/downloads/,点击Community,选择MySQL on Windows,选择MySQL Installer,选择MySQL S ...

  2. 【转】使用Jmeter录制web脚本

    1.web性能测试以及web http请求基本原理. 再介绍录制jmeter脚本之前,我们先谈一下web性能测试.web就是调用http/https接口, 其实没有是什么复杂度可言.只是我们必须清楚, ...

  3. 1115 Counting Nodes in a BST

    题意:给出一棵二叉搜索树的插入序列,要求该树最后两层的结点个数. 思路:在树结点中增加一个数据域layer,表示该结点所在的层次.另外,设置数组level[]和变量maxLevel,level[i]表 ...

  4. C语言中的未初始化变量的值

    C语言中未初始化的变量的值是0么 全局变量 .静态变量初始值为0局部变量,自动变量初始值随机分配 C语言中,定义局部变量时如果未初始化,则值是随机的,为什么? 定义局部变量,其实就是在栈中通过移动栈指 ...

  5. Nginx反向代理图片总结

    配置需求: 内网192.168.80.205的机器上部署了一个Web项目,下文称web,   url为http://192.168.80.205:8082.   并且使用nginx访问图片,url格式 ...

  6. 关于object-c类目的理解

    类目:为已知的类增加新的方法: 一.类目: 1. 类目方法的应用: 对现有类进行扩展:比如:可以扩展Cocoa touch框架中的类,在类目中增加的方法会被子类继承,而且在运行时跟其他的方法没有区别. ...

  7. jQ版大图滚动

    <!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <title&g ...

  8. Patator-一款很好用的爆破工具

    项目地址:https://github.com/lanjelot/patator 打开文件夹 运行一下文件查看帮助 python patator.py --help 这里有很多的爆破选项,就不一一截图 ...

  9. java成神之——jaxb操作xml的基本使用

    JAXB 依赖 读取xml配置 写配置 自定义写配置 结语 JAXB 依赖 <dependency> <groupId>javax.activation</groupId ...

  10. js 鼠标点击文本框 提示文字消失

    onfocus="if(this.value==defaultValue) {this.value='';}" onblur="if(!value) {value=def ...