Hi Experts,
My winform has various texboxes inside panels and outside the panels.
I want to set their properties like backcolor, enabled etc in a separate class.
but we are unable to do it.
I have also tried like this:
"foreach(Control c in Controls)"
, but unable to access that control exits in panel.
Kindly suggest me the best.
--- Anil Kumar.
Thanks for prompt replies. In that scenario i have already implemented successful code for datagridview as below: -
code for the form having DataGridView:
======================================
...
....
...
ConnetDataBase conDB = new ConnetDataBase();
...
...
conDB.FillDataGrid(Sql, dgvUserList);
code for class: -
================
class ConnetDataBase
{
public void FillDataGrid( string Sql,DataGridView dgvName)
{
try
{
connection.Open();
adapter = new SqlDataAdapter(Sql, connection);
DataSet ds = new DataSet();
adapter.Fill(ds);
dgvName.DataSource = ds.Tables[0];
connection.Close();
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
}
}
}
---------------------------
This works fine for any datagridview calling from any forms.
But for textbox or other controls how can it may be implemented ?
--- Anil kumar