Extended Text box controls in C#

Aug 6 2015 6:49 AM

Hi all,

Good Day! I am using C# Visual Studio 2008. in this i am developing code for setting property value of extended text boxes. In this extended text box i can set property of data required and data type. But when i am using tab page control as ctrl that common name i couldn't set property. i am not getting these extended properties.

And my code is:

TabPage pTbPage = tabControl1.SelectedTab;  
foreach (Control ctrl in pTbPage.Controls) //Validation 
{ 
if ((ctrl) is extdTextBox) 
{                       
findFieldName = "fld" + ctrl.Name.Substring(3, (ctrl.Name.Length) - 3); 
try // read validation table {                          
sltqry = "SELECT * FROM tValidation where (tTName='" + table2Select + "') and (tFName='" + findFieldName + "')";                          
cmd = new SqlCommand(sltqry, cn);                          
cmd.CommandType = CommandType.Text;                          
rdr = cmd.ExecuteReader();                         
 rdr.Read(); 
if (rdr != null && rdr.HasRows) foundRecord = true; 
if (foundRecord == true) 
{                              
getType = rdr.GetString(rdr.GetOrdinal("tType"));
 if(getType=="Int") 
{                               
ctrl.//not getting Datatype property
 //here i want set data type as Whole number 
} 
if (rdr.GetString(rdr.GetOrdinal("tReqd")) == "TRUE") 
{                               
 ctrl. //not getting DAtaRequired  //here i want set data required as yes   
 } 
                          
rdr.Close();                          
cmd.Dispose(); } //try catch (Exception ex) 
{                         
 errlog(calgRotnTryName, ex.Message, sltqry); //function to insert error message details into terrlog table 
if (msgBoxCount == 0) { MessageBox.Show(calgRotnTryName + " " + ex.Message); 
} 
} //catch (Exception ex) 
} //if ((ctrl) is extdTextBox) 
} //foreach (Control ctrl in pTbPage.Controls)  //Validation

Answers (2)