Set Textbox BorderStyle to None Dynamically in 2008

R

Ryan

The line below marked with * is not valid in vb.net 2008; how do I set the
border dynamically?

Dim cControl As Control
For Each cControl In Me.Controls
If (TypeOf cControl Is TextBox) Then
cControl.BackColor = Color.White
cControl.BorderStyle=None '*****************'
End If
Next cControl
 
A

Armin Zingler

Am 03.03.2010 00:36, schrieb Ryan:
The line below marked with * is not valid in vb.net 2008; how do I set the
border dynamically?

Dim cControl As Control
For Each cControl In Me.Controls
If (TypeOf cControl Is TextBox) Then
cControl.BackColor = Color.White
cControl.BorderStyle=None '*****************'
End If
Next cControl


If you switch Option Strict On and do the right cast,
intellisense should offer BorderStyle.None:

DirectCast(cControl, TextBox).BorderStyle = BorderStyle.None
 
R

Ryan

Thanks, it worked.

Armin Zingler said:
Am 03.03.2010 00:36, schrieb Ryan:


If you switch Option Strict On and do the right cast,
intellisense should offer BorderStyle.None:

DirectCast(cControl, TextBox).BorderStyle = BorderStyle.None
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top