Here is my case:
I have created 2 form which is login form, which username textbox already connected to the database and it is successfully.
When user login, it direct to the second form, and in the second form, there are multiple textbox that i have created using Array List, and it has shown.
Here is my problem:
I want to connect the textboxes in second form to the database, but it shown nothing when i run the program, i already trace the code which is the error, and the error is on when OleDBDataReader is reading, i dunno what's wrong with my code, in login form it run perfectly, but in the second form, there is an error.
Here is the image for Login Form:
Here is the image for Second Form:
Here is the code for Second Form:
private List<List<TextBox>> textBoxCodeContainer = new List<List<TextBox>>();
string connectionString = (@"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=\Archives\Projects\Program\Sell System\Sell System\App_Data\db1.accdb;Persist Security Info=False;");
//****TextBox for Code****
for (int y = 0; y <= 16; y++)
textBoxCodeContainer[y].Size = new Size(100, 50);
textBoxCodeContainer[y].Location = new Point(25, 150 + (y * 25));
OleDbConnection conn = new OleDbConnection(connectionString);
OleDbCommand cmd = new OleDbCommand("SELECT DISTINCT [Code] FROM [Data] ORDER BY
dReader = cmd.ExecuteReader();
AutoCompleteStringCollection codesCollection = new AutoCompleteStringCollection();
textBoxCodeContainer.AutoCompleteMode = AutoCompleteMode.Suggest;
textBoxCodeContainer.AutoCompleteSource = AutoCompleteSource.CustomSource;
textBoxCodeContainer.AutoCompleteCustomSource = codesCollection;
For the Second Form, in the column of code, it supposed to shown the autocomplete like at the Login Form.