小编Sri*_*ari的帖子

在C#winform devexpress中,对象引用未设置为对象错误的实例?

我在表单中有Gridview,如果我单击Gridview上的按钮,我会获得Focused Row的Column值,并尝试在下一个Form中使用该值.但是在这种新形式的错误显示如下

 public partial class New_Invoice : DevExpress.XtraEditors.XtraForm
{

    string getOper = "A";

    public New_Invoice()
    {
        InitializeComponent();
    }

    public New_Invoice(string oper, int invoiceno)
    {
        // TODO: Complete member initialization

        textEdit5.Text = invoiceno.ToString(); // error shown in this line
        textEdit5.Visible = false;
        getOper = oper;
    }  
Run Code Online (Sandbox Code Playgroud)

我的代码出了什么问题?

c# winforms

1
推荐指数
1
解决办法
1616
查看次数

无法将对象从DBNull强制转换为显示的其他类型错误?

我的代码是这样的

    private MyCatch _catch = new MyCatch("Description");

    decimal getTotalValue(GridView view, int listSourceRowIndex)
    {
        decimal unitPrice = Convert.ToDecimal(view.GetListSourceRowCellValue(listSourceRowIndex, "Each"));  //Object cannot be cast from DBNull to other types
        decimal quantity = Convert.ToDecimal(view.GetListSourceRowCellValue(listSourceRowIndex, "Quantity"));
        decimal discount = Convert.ToDecimal(view.GetListSourceRowCellValue(listSourceRowIndex, "TaxPercentage"));
        return unitPrice * quantity * (1 - discount);
    }

    private void gridView1_CustomUnboundColumnData(object sender, DevExpress.XtraGrid.Views.Base.CustomColumnDataEventArgs e)
    {
        GridView view = sender as GridView;
        if (e.Column.FieldName == "Totalototal" && e.IsGetData) e.Value =
          getTotalValue(view, e.ListSourceRowIndex);
    }
Run Code Online (Sandbox Code Playgroud)

c# devexpress winforms

1
推荐指数
1
解决办法
3万
查看次数

当我的第一页内容较少时,XtreReport显示第二个空白页面?Winforms Devexpress

我使用了三个DetailReports和一个PageFooter.仅在我的第一页中可用的数据较少,但是当我预览或运行程序时,它显示两页为什么?我的第一页已经只填写了较少的内容.我的代码有什么问题?

c# devexpress report xtrareport winforms

1
推荐指数
1
解决办法
2302
查看次数

如何从C#检查计算机桌面中是否存在文件夹?

我需要从C#查看计算机桌面中存在的文件夹C:\\Users\\MyComputer\\Desktop\\Test.如果不存在,我需要添加一个文件夹Test.

我有代码来创建一个文件夹 Test

string desktopPath = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory);
System.IO.Directory.CreateDirectory(desktopPath + "\\Test");
Run Code Online (Sandbox Code Playgroud)

但在此之前,我需要检查该文件夹是否存在.如何从C#查看?帮我完成这个任务.

提前致谢.斯里里

c#

1
推荐指数
1
解决办法
1209
查看次数

标签 统计

c# ×4

winforms ×3

devexpress ×2

report ×1

xtrareport ×1