我在表单中有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)
我的代码出了什么问题?
我的代码是这样的
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) 我使用了三个DetailReports和一个PageFooter.仅在我的第一页中可用的数据较少,但是当我预览或运行程序时,它显示两页为什么?我的第一页已经只填写了较少的内容.我的代码有什么问题?
我需要从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#查看?帮我完成这个任务.
提前致谢.斯里里