0

我正在 c#.net 2010 中开发一个 Windows 应用程序。它基本上是一个库存管理应用程序。用户将在这里开具发票。

问题是它们可能是n发票中的项目数。我如何从n项目数量中获取用户的输入?

在 VB6.0 中,我使用带有文本框的 mshflex 网格,并根据需要将不同的控件集成到 mshflexgrid 中。

4

2 回答 2

0

您可以使用可编辑DataGridView的 . 用户可以直接在 GridView 行中键入详细信息,而不是填写发票表单。这将允许用户插入任意数量的发票详细信息。

编辑

在当前聚焦的单元格旁边打开一个窗口。

您可以使用当焦点在 DatGridView 上CellEnter时触发的事件。Cell

private void dataGridView1_CellEnter(object sender, DataGridViewCellEventArgs e)
{
       //Give the relevant column index where pop up windows needs to be opened.
    if (e.ColumnIndex.Equals(1))
    {
        //Getting the position of the current cell.
        Point loc = dataGridView1.PointToScreen(dataGridView1.GetCellDisplayRectangle(e.ColumnIndex, e.RowIndex, false).Location);
    }
}
于 2013-09-20T08:28:12.163 回答
0

您可以使用 GridView。您可以按如下方式在每个单元格中输入数据:

 dataGridView1.Rows[rowIndex].Cells[columnIndex].Value = value;

只需输入以下代码即可插入新行:

 this.dataGridView1.Rows.Add();

还有一种替代方法。您可以使用文本框、组合框、标签、按钮等创建用于存储单个项目信息的表单。为项目输入数据后,使用按钮可以保存数据。然后清除所有控件。现在,输入下一项的信息,依此类推。

于 2013-09-20T08:33:14.083 回答