在vb中打印组合框数据 [英] print combobox data in vb

查看:64
本文介绍了在vb中打印组合框数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨.我创建一些用于打印数据的程序.这是工作.然后我需要添加标题,因为那里有公司名称.相关的公司名称加载到组合框中.我需要将此名称添加到我的报告中.我的代码就是这样.请帮助我

  Dim  msg = MsgBox(" 如果 msg = MsgBoxResult.Ok 然后

             Dim  dt  As   New  DataTable
            使用 dt
                .Columns.Add(" )
                .Columns.Add(" )
                .Columns.Add(" )
                .Columns.Add(" )
                .Columns.Add(" )
                .Columns.Add(" )
                .Columns.Add(" )
                .Columns.Add(" )
                .Columns.Add(" )
                .Columns.Add(" )

            结束 使用
            对于 每个 dr  As  DataGridViewRow  .DataGridView1.Rows
                dt.Rows.Add(dr.Cells(" ).值,dr.Cells(" ).值,Dr.Cells(" 金额").Value,dr.Cells( ).Value,dr.Cells( 现金").Value ,dr.Cells(" ).值,dr.Cells(  AC_No").Value,dr.Cells(  Cheuq_no").Value,dr.Cells( 发布日期").Value,dr.Cells(" ).Value)
            下一步

             Dim  rptdoc  As  CrystalDecisions.CrystalReports.Engine.ReportDocument
            rptdoc =  CrystalReport1
            rptdoc.SetDataSource(dt)

            Form1.CrystalReportViewer1.ReportSource = rptdoc
            Form1.ShowDialog()
            Form1.Dispose()
        结束 如果
结束  sub  



谢谢.等待很快答复...

解决方案

在水晶报表上创建一个文本框以打印公司名称"

并在以下代码的帮助下,使用组合框中的值填充此文本框.

 CrystlReport1.txtcompanyname.text = cmbcompanyname.text 




希望这会有所帮助,如果是,则接受并投票回答,否则返回您的查询
--Rahul D.


hi. i create some programe for print datagride data. its work. then i need add heading as there company name.relevant company name load into combobox. i need add this name to my report. my code is like that.please help me

   Dim msg = MsgBox("Are you sure Print this bill..?", MsgBoxStyle.OkCancel)
        If msg = MsgBoxResult.Ok Then

            Dim dt As New DataTable
            With dt
                .Columns.Add("No")
                .Columns.Add("Date")
                .Columns.Add("Amount")
                .Columns.Add("Cheque")
                .Columns.Add("Cash")
                .Columns.Add("Balance")
                .Columns.Add("AC_No")
                .Columns.Add("Cheuq_no")
                .Columns.Add("Released_date")
                .Columns.Add("Value")

            End With
            For Each dr As DataGridViewRow In Me.DataGridView1.Rows
                dt.Rows.Add(dr.Cells("No").Value, dr.Cells("Date").Value, dr.Cells("Amount").Value, dr.Cells("Cheque").Value, dr.Cells("Cash").Value, dr.Cells("Balance").Value, dr.Cells("AC_No").Value, dr.Cells("Cheuq_no").Value, dr.Cells("Released_date").Value, dr.Cells("Value").Value)
            Next

            Dim rptdoc As CrystalDecisions.CrystalReports.Engine.ReportDocument
            rptdoc = New CrystalReport1
            rptdoc.SetDataSource(dt)

            Form1.CrystalReportViewer1.ReportSource = rptdoc
            Form1.ShowDialog()
            Form1.Dispose()
        End If
end sub



thank. waiting for soon reply...

解决方案

Create one text box on crystal report to print "company name"

and with the help of below code populate this text box with value from combo box.

CrystlReport1.txtcompanyname.text = cmbcompanyname.text




Hope this helps if yes then accept and vote the answer otherwise revert back with your queries
--Rahul D.


这篇关于在vb中打印组合框数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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