public void Disease_Load(object sender, EventArgs e)
{
DiseaseList();
}
-----------------------------------
private void DiseaseList()
{
string constr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=.\\PIS(ACU).mdb;";
Con = new OleDbConnection(@constr);
Con.Open();
Com = new OleDbCommand();
Com.Connection = Con;
Com.CommandText = "SELECT DiseaseName FROM Disease";
OleDbDataReader da = Com.ExecuteReader();
object[] obj = new object[256];
while (da.Read())
{
da.GetValues(obj);
lstDisease.Items.Add((string)da["DiseaseName"]);
}
da.Close();
Con.Close();
}
---------------------------------------
private void txtContactNo_KeyPress(object sender, KeyPressEventArgs e)
{
if (!char.IsControl(e.KeyChar)
&& !char.IsDigit(e.KeyChar)
&& e.KeyChar != '.')
{
e.Handled = true;
}
if (e.KeyChar == '.'
&& (sender as TextBox).Text.IndexOf('.') > -1)
{
e.Handled = true;
}
}
{
DiseaseList();
}
-----------------------------------
private void DiseaseList()
{
string constr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=.\\PIS(ACU).mdb;";
Con = new OleDbConnection(@constr);
Con.Open();
Com = new OleDbCommand();
Com.Connection = Con;
Com.CommandText = "SELECT DiseaseName FROM Disease";
OleDbDataReader da = Com.ExecuteReader();
object[] obj = new object[256];
while (da.Read())
{
da.GetValues(obj);
lstDisease.Items.Add((string)da["DiseaseName"]);
}
da.Close();
Con.Close();
}
---------------------------------------
private void txtContactNo_KeyPress(object sender, KeyPressEventArgs e)
{
if (!char.IsControl(e.KeyChar)
&& !char.IsDigit(e.KeyChar)
&& e.KeyChar != '.')
{
e.Handled = true;
}
if (e.KeyChar == '.'
&& (sender as TextBox).Text.IndexOf('.') > -1)
{
e.Handled = true;
}
}
No comments:
Post a Comment