Exemplo n.º 1
0
        private void btnFind_Click(object sender, EventArgs e)
        {
            if (txtSearch.Text.Equals("") || txtSearch.Text.Length < 3)
            {
                MessageBox.Show("Invalid Search", "Invalid Search", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            DataRow[] foundRecords;
            titlesTable.DefaultView.Sort = "Title";
            foundRecords = titlesTable.Select("Title LIKE '*" + txtSearch.Text + "*'");

            if (foundRecords.Length == 0)
            {
                MessageBox.Show("No record Found", "No record Found", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                frmSearch searchForm = new frmSearch(foundRecords, "Titles");
                searchForm.ShowDialog();
                var index = searchForm.Index;
                titlesManager.Position = titlesTable.DefaultView.Find(foundRecords[index]["Title"]);
                GetAuthors();
            }
        }
Exemplo n.º 2
0
        private void btnSearch_Click(object sender, EventArgs e)
        {
            if (txtSearch.Text.Length < 3 || txtSearch.Text.Equals(""))
            {
                MessageBox.Show("Invalid search", "Invalid", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            DataRow[] foundRecord;
            authorsTable.DefaultView.Sort = "Author";
            foundRecord = authorsTable.Select("Author LIKE '*" + txtSearch.Text + "*'");

            if (foundRecord.Length == 0)
            {
                MessageBox.Show("Nothing was found", "Nothing", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                frmSearch searchForm = new frmSearch(foundRecord, "Authors");
                searchForm.ShowDialog();
                var index = searchForm.Index;
                authorsManager.Position = authorsTable.DefaultView.Find(foundRecord[index]["Author"]);
            }
        }
        private void btnSearch_Click(object sender, EventArgs e)
        {
            if (txtSearch.Text.Equals("") || txtSearch.Text.Length < 3)
            {
                MessageBox.Show("Invalid Search", "Invalid", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            DataRow[] foundRows;
            pubTable.DefaultView.Sort = "Name";
            foundRows = pubTable.Select("Name LIKE '*" + txtSearch.Text + "*'");

            if (foundRows.Length == 0)
            {
                MessageBox.Show("No Record Found", "No Record Found", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                frmSearch searchForm = new frmSearch(foundRows, "Publishers");
                searchForm.ShowDialog();
                var index = searchForm.Index;
                pubManager.Position = pubTable.DefaultView.Find(foundRows[index]["Name"]);
            }
        }