我想编辑我存储在2D数组中的第一列文本文件

时间:2017-03-19 13:36:25

标签: c#

我的代码看起来像这样

using System.IO;

public partial class optionForm1 : Form
{
    const int ROWS = 20;
    const int COLS = 8, NUMBER =1, NAME=0;
    public const char SEPARATOR = '|';
    String[][] transactions = new String[ROWS][];
    int recordCount = 0;

    //User enters name they are looking for and clicks
    private void nameButton_Click(object sender, EventArgs e)
    {
        for (int row = 0; row < ROWS;  row++)
        {
            if (transactions[row][NAME].ToLower().Contains(searchTextBox.Text.ToLower()))
            {
                for (int col = 0; col < transactions[row].Length; col++)
                {
                    //currentRow = row;
                    transactionsListBox.Items.Add(transactions[row][col]);
                }

//我输入了一个不同的名字&#34; George Smith&#34;在文本框中,但它只是将其添加到现有行下面,但它不会替换名称

private void editButton_Click(object sender,EventArgs e)

    {
        foreach (var NAME in transactions)
        {
            transactionsListBox.Items.Add(editTextBox.Text);
        }

Keith Earls | 128 * 120000 | 14|2.00%||| 19.05 | 2017/09/19 | 19 |

乔治史密斯

乔治史密斯

感谢您的耐心

    }

0 个答案:

没有答案