Results 1 to 11 of 11

Thread: TextBox

  1. #1

    Thread Starter
    PowerPoster
    Join Date
    Dec 2003
    Location
    Bristol, England (but heart is in Virginia)
    Posts
    2,949

    TextBox

    Hi,

    Could anyone please tell me why both the following work?

    TextBox.Text = "Something"

    TextBox().Text = "Something"
    Taxes
    The more I learn about VB.NET the more I like dBaseIII Plus

    The foregoing, whilst believed to be correct, is given without guarantee as to it's accuracy and entirely without recourse. You are required to decide for yourself whether or not it is suitable for your purposes and no liability for loss of any nature can be entertained.

  2. #2
    Frenzied Member Mike Hildner's Avatar
    Join Date
    Jul 2002
    Location
    Des Moines, NM
    Posts
    1,690

    Re: TextBox

    Can't tell you why, but it's a little wierd. Makes it difficult to read. FWIW, C# won't let you do that.

  3. #3
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: TextBox

    I'd like to know too. But I'll take a guess and say that it's because TextBox1() is the same as referring to the only element in this zero dimensional array of textboxes.

    I suppose if there were an array of textboxes, you'd be going

    TextBox1(4).Text = "ABC"

  4. #4

    Thread Starter
    PowerPoster
    Join Date
    Dec 2003
    Location
    Bristol, England (but heart is in Virginia)
    Posts
    2,949

    Re: TextBox

    Zero Dimension Array????

    I though that only existed in the brains of our politicians
    Taxes
    The more I learn about VB.NET the more I like dBaseIII Plus

    The foregoing, whilst believed to be correct, is given without guarantee as to it's accuracy and entirely without recourse. You are required to decide for yourself whether or not it is suitable for your purposes and no liability for loss of any nature can be entertained.

  5. #5
    Fanatic Member Graff's Avatar
    Join Date
    Jan 2002
    Location
    Calgary
    Posts
    668

    Re: TextBox

    Not to mention you can't do textbox(4).text in .net because control arrays where removed.
    If wishes were fishes we'd all cast nets.

  6. #6

    Thread Starter
    PowerPoster
    Join Date
    Dec 2003
    Location
    Bristol, England (but heart is in Virginia)
    Posts
    2,949

    Re: TextBox

    Quote Originally Posted by Graff
    Not to mention you can't do textbox(4).text in .net because control arrays where removed.
    For all practical purposes, Control Arrays DO still exist in .NET. You just don't have a Control.Index property. They are not called that, but there is an Array of Controls available. E.G.

    VB Code:
    1. Dim ctl As Control
    2.         Dim TBArray(0) As TextBox
    3.         Dim iCount As Integer
    4.         For Each ctl In Me.Controls
    5.             If TypeOf ctl Is TextBox Then
    6.                 TBArray(iCount) = CType(ctl, TextBox)
    7.                 iCount += 1
    8.                 ReDim Preserve TBArray(iCount)
    9.             End If
    10.         Next

    Or you can make up your own index using the Tag property but that is not so flexible.
    Taxes
    The more I learn about VB.NET the more I like dBaseIII Plus

    The foregoing, whilst believed to be correct, is given without guarantee as to it's accuracy and entirely without recourse. You are required to decide for yourself whether or not it is suitable for your purposes and no liability for loss of any nature can be entertained.

  7. #7
    type Woss is new Grumpy; wossname's Avatar
    Join Date
    Aug 2002
    Location
    #!/bin/bash
    Posts
    5,682

    Re: TextBox

    Quote Originally Posted by Graff
    Not to mention you can't do textbox(4).text in .net because control arrays where removed.
    You can have an array of anything in .net (pretty much). The framework doesn't give a damn if you want to declare

    dim tb() as textbox = new textbox(5) {}

    that's perfectly valid. Control arrays in VB6 were weird things and not even proper arrays.
    I don't live here any more.

  8. #8
    Fanatic Member Graff's Avatar
    Join Date
    Jan 2002
    Location
    Calgary
    Posts
    668

    Re: TextBox

    But they made life easy.
    If wishes were fishes we'd all cast nets.

  9. #9
    Member
    Join Date
    Jan 2005
    Location
    in the nederlands
    Posts
    37

    Re: TextBox

    you need to use this

    textbox1.text = "somthing"
    what is xml ???

    help my please on this link for xml
    http://www.vbforums.com/showthread.php?t=322815



  10. #10

    Thread Starter
    PowerPoster
    Join Date
    Dec 2003
    Location
    Bristol, England (but heart is in Virginia)
    Posts
    2,949

    Re: TextBox

    Quote Originally Posted by Graff
    But they made life easy.

    Hi,

    Using an array of controls in VB.NET is just as easy as using a Control Array in VB6.
    Taxes
    The more I learn about VB.NET the more I like dBaseIII Plus

    The foregoing, whilst believed to be correct, is given without guarantee as to it's accuracy and entirely without recourse. You are required to decide for yourself whether or not it is suitable for your purposes and no liability for loss of any nature can be entertained.

  11. #11
    Fanatic Member Graff's Avatar
    Join Date
    Jan 2002
    Location
    Calgary
    Posts
    668

    Re: TextBox

    Not quite
    If wishes were fishes we'd all cast nets.

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