dynamically setting MaxLength property of a Textbox
-
Hi! i have many textboxes on a form in a vb .net 2005 application these textboxes are databound. Is there any way i can set the MaxLength property of these textboxes (which are bound to varchar fields in the database) to the size of the field in the database. Or how do i access the field (i.e. DataColumn of the table) to which a textbox is bound. Thank You
-
Hi! i have many textboxes on a form in a vb .net 2005 application these textboxes are databound. Is there any way i can set the MaxLength property of these textboxes (which are bound to varchar fields in the database) to the size of the field in the database. Or how do i access the field (i.e. DataColumn of the table) to which a textbox is bound. Thank You
may be you should try textbox1.mexlength = 20 'Length Good Luck
-
may be you should try textbox1.mexlength = 20 'Length Good Luck
but, the problem remains. what length should i set as i don't know the lenght of the field in the database?
-
but, the problem remains. what length should i set as i don't know the lenght of the field in the database?
-
but, the problem remains. what length should i set as i don't know the lenght of the field in the database?
for that issue u have to keep track of which field u are accessing There is another way to do it but this will introduce a real big overload on the system and application will become slow... What you can do is just before you set the size of textbox do a query and to get the field size(I am not sure how to do it... but for sure there will be a query for sure)... and then assign the max size of textbox Good Luck
-
for that issue u have to keep track of which field u are accessing There is another way to do it but this will introduce a real big overload on the system and application will become slow... What you can do is just before you set the size of textbox do a query and to get the field size(I am not sure how to do it... but for sure there will be a query for sure)... and then assign the max size of textbox Good Luck
why do i need to query the database for the length of the field since my textboxes are databound (using drag & drop from the data sources window) and the properties of the the datatables show the mapped fields (i.e. varchar(6) to system.string with length 6). Is there any way I can access these properties of the datatables.