'Search.playersTableAdapter' is inaccessible due to its protection level

  • Thread starter Thread starter kgosi_mocumi
  • Start date Start date
K

kgosi_mocumi

Guest
Good Day,

I have two forms form1 with a DataGridView Control form 2:Search with a DetailsView control.On Form 1 with the Datagridview I have a a search button and a textbox that allows the user to specify a name in a textbox .When the Search button is clicked, a search in the database is executed according to the name entered and the matching record should be displayed in the detailview on the Search form. when I execute my code I get the following errors on line 66. 'Search.playersTableAdapter' is inaccessible due to its protection level and 'Search.cricketDataSet' is inaccessible due to its protection level. Here is my code.

Form1:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace Question_2
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

private void playersBindingNavigatorSaveItem_Click(object sender, EventArgs e)
{
this.Validate();
this.playersBindingSource.EndEdit();
this.tableAdapterManager.UpdateAll(this.cricketDataSet);

}

private void Form1_Load(object sender, EventArgs e)
{
// TODO: This line of code loads data into the 'cricketDataSet.Players' table. You can move, or remove it, as needed.
this.playersTableAdapter.Fill(this.cricketDataSet.Players);

}

private void totalButton_Click(object sender, EventArgs e)
{
// Declare vaariable for Total Batting Average.
decimal totalBattingAverage;

// Store the total batting average.
totalBattingAverage = (decimal)this.playersTableAdapter.TotalBattingAverage();

// Display message for average.
MessageBox.Show("Total Batting Average: " + totalBattingAverage);
}

private void averageButton_Click(object sender, EventArgs e)
{
// Declare vaariable for the average Batting Average.
decimal averageBattingaverage;

// Store the average batting average.
averageBattingaverage = (decimal)this.playersTableAdapter.AverageBattingAverage();

// Display message for the average batting total.
MessageBox.Show("Average Batting average: " + averageBattingaverage);
}

private void searchButton_Click(object sender, EventArgs e)
{
//string nm = searchTextBox.Text;
Search fm = new Search();

fm.playersTableAdapter.SearchByFirstname(fm.cricketDataSet.Players,searchTextBox.Text);

fm.ShowDialog();
}

private void tabPage1_Click(object sender, EventArgs e)
{
// Sort first tab in descending order.
this.playersTableAdapter.DescendingOrder(this.cricketDataSet.Players);
}

private void tabPage2_Click(object sender, EventArgs e)
{
this.playersTableAdapter.FillByLess50(this.cricketDataSet.Players);
}


}
}

Is there a way I can fix this

Continue reading...
 
Back
Top