Results 1 to 5 of 5

Thread: Textbox

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Apr 2008
    Posts
    96

    Textbox

    I have a form that has 24 textboxes in it, I am using the code below so that when the program is running, it will not show the border around the texbox.

    Is there a easy way to make this code smaler (now 24 lines) .

    Code:
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
            ' make border none
            Me.txtTerminator_R.BorderStyle = System.Windows.Forms.BorderStyle.None
            Me.txtBig_Bang_R.BorderStyle = System.Windows.Forms.BorderStyle.None
            Me.txtChuck_R.BorderStyle = System.Windows.Forms.BorderStyle.None
    
    ......
    ......
    .....

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: Textbox

    Why wouldn't you just set the BorderStyle property in the designer?
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Apr 2008
    Posts
    96

    Re: Textbox

    I am going to work quit a lot on the designer and I want to see where the texboxes borders are, to work on them, when I run the program, i don't want to see the border of the texboxes

  4. #4
    PowerPoster sparrow1's Avatar
    Join Date
    May 2005
    Location
    Globetrotter
    Posts
    2,820

    Re: Textbox

    Hi,

    Then you can do a For each loop to make your code smaler.

    Wkr,

    sparrow1
    Wkr,
    sparrow1

    If I helped you, don't forget to Rate my post. Thank you

    I'm using Visual Studio.Net 2003 and
    2005
    How to learn VB.Net Create setup with VB 2005 Drawing for beginners VB.Net Tutorials GDI+ Tutorials
    Video's for beginners

  5. #5
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    26,422

    Re: Textbox

    vb Code:
    1. for each ctrl as control in me.controls
    2.      if ctrl.gettype = gettype(textbox) then
    3.         ctrl.BorderStyle = System.Windows.Forms.BorderStyle.None
    4.      end if
    5. next

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width