|
-
Jan 17th, 2005, 06:52 AM
#1
Thread Starter
PowerPoster
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.
-
Jan 17th, 2005, 10:54 AM
#2
Frenzied Member
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.
-
Jan 17th, 2005, 10:55 AM
#3
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"
-
Jan 17th, 2005, 11:01 AM
#4
Thread Starter
PowerPoster
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.
-
Jan 17th, 2005, 11:10 PM
#5
Fanatic Member
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.
-
Jan 18th, 2005, 05:05 AM
#6
Thread Starter
PowerPoster
Re: TextBox
 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:
Dim ctl As Control
Dim TBArray(0) As TextBox
Dim iCount As Integer
For Each ctl In Me.Controls
If TypeOf ctl Is TextBox Then
TBArray(iCount) = CType(ctl, TextBox)
iCount += 1
ReDim Preserve TBArray(iCount)
End If
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.
-
Jan 18th, 2005, 05:58 AM
#7
Re: TextBox
 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.
-
Jan 18th, 2005, 03:19 PM
#8
Fanatic Member
If wishes were fishes we'd all cast nets.
-
Feb 1st, 2005, 06:19 AM
#9
Member
Re: TextBox
you need to use this
textbox1.text = "somthing"
-
Feb 1st, 2005, 06:39 AM
#10
Thread Starter
PowerPoster
Re: TextBox
 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.
-
Feb 1st, 2005, 10:04 AM
#11
Fanatic Member
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|