473,320 Members | 1,887 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

another array question

i'm making a form where you can add textboxes with a button.
the max number of textboxes to add is 100

but i also must create an array of al thes textboxes,

is there a way of creating an array of thextboxes that aren't created yet.

fot exapmle
Dim delayarray(100) As TextBox(100) <--------------- this won't work
ofcourse

For inti = 1 To 5

Me.Controls.Add(delayarray(inti))

delayarray(inti).Location = New Point(56, inti *10 + 64)

delayarray(inti).Visible = True

Next

thanks Maarten
Nov 21 '05 #1
19 1054
Dim mytextboxes As TextBox()
ReDim textboxes(100)

for i as integer to 100
mytextboxes(i) = new Textbox
mytextboxes(i).Text = i.tostring
next i

"Maarten" wrote:
i'm making a form where you can add textboxes with a button.
the max number of textboxes to add is 100

but i also must create an array of al thes textboxes,

is there a way of creating an array of thextboxes that aren't created yet.

fot exapmle
Dim delayarray(100) As TextBox(100) <--------------- this won't work
ofcourse

For inti = 1 To 5

Me.Controls.Add(delayarray(inti))

delayarray(inti).Location = New Point(56, inti *10 + 64)

delayarray(inti).Visible = True

Next

thanks Maarten

Nov 21 '05 #2
Maarten,
Dim delayarray(100) As TextBox(100) <--------------- this won't work

Here you try to create an array of 101 textbox arrays (where the last wont
even go)

When you know how many textboxes you want than use the fixed array
\\
Dim delayarray(99) As TextBox()
For inti = 0 To 99
delayarray(inti).name = "MyTextBox" & inti.tostring
Me.Controls.Add(delayarray(inti))
delayarray(inti).Location = New Point(56, inti *10 + 64)
delayarray(inti).Visible = True
Next
///
When you do not know how many you want to use (strange in this kind of
situations however let us suppose, you can use the arraylist)
\\\
dim delayarray as new arraylist
For inti = 0 To 99
directcast(delayarray,textbox).name = "MyTextBox" & inti.tostring
dlayarray.add(delayarray)
Me.Controls.Add(delayarray(inti))
directcast(delayarray(inti),textbox).Location = New Point(56, inti *10 + 64)
directcast(delayarray(inti),textbox).Visible = True
Next
///
All typed(changed) in this message so watch typos.

I hope this helps?

Cor
Nov 21 '05 #3
"Dennis" <De****@discussions.microsoft.com> schrieb:
Dim mytextboxes As TextBox()
ReDim textboxes(100)

for i as integer to 100
mytextboxes(i) = new Textbox
mytextboxes(i).Text = i.tostring
next i


\\\
Const TextBoxesCount As Integer = 100
Dim TextBoxes(TextBoxesCount - 1) As TextBox
For i = 0 To TextBoxes.Length - 1
TextBoxes(i) = New TextBox()
...
Next i
Me.Controls.AddRange(TextBoxes)
///

;-)

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
Nov 21 '05 #4
doh, I change my samples.

Cor
Nov 21 '05 #5
Maarten,

Luckily Herfried shows an ommission in my samples.
\\
Dim delayarray(99) As TextBox()
For inti as integer = 0 To 99
delayarray(inti) = new Textbox
delayarray(inti).name = "MyTextBox" & inti.tostring
Me.Controls.Add(delayarray(inti))
delayarray(inti).Location = New Point(56, inti *10 + 64)
delayarray(inti).Visible = True
Next
///
When you do not know how many you want to use (strange in this kind of
situations however let us suppose, you can use the arraylist)

\\\
Dim delayarray As New ArrayList
For inti As Integer = 0 To 99
delayarray.Add(New TextBox)
Me.Controls.Add(DirectCast(delayarray(inti), TextBox))
DirectCast(delayarray(inti), TextBox).Name = "MyTextBox" & inti.ToString
DirectCast(delayarray(inti), TextBox).Location = New Point(56, inti * 10
+ 64)
DirectCast(delayarray(inti), TextBox).Visible = True
Next
///

The last one I checked now.

Cor
Nov 21 '05 #6
"Cor Ligthert" <no************@planet.nl> schrieb:
For inti as integer = 0 To 99
delayarray(inti) = new Textbox
delayarray(inti).name = "MyTextBox" & inti.tostring
Me.Controls.Add(delayarray(inti))
delayarray(inti).Location = New Point(56, inti *10 + 64)
delayarray(inti).Visible = True
Next
///
When you do not know how many you want to use (strange in this kind of
situations however let us suppose, you can use the arraylist)

\\\
Dim delayarray As New ArrayList
For inti As Integer = 0 To 99
delayarray.Add(New TextBox)
Me.Controls.Add(DirectCast(delayarray(inti), TextBox))
DirectCast(delayarray(inti), TextBox).Name = "MyTextBox" & inti.ToString
DirectCast(delayarray(inti), TextBox).Location = New Point(56, inti * 10
+ 64)
DirectCast(delayarray(inti), TextBox).Visible = True


I'd try to get rid of the 'DirectCast's:

\\\
With DirectCast(delayarray(inti), TextBox)
.Name = ...
.Location = ...
.Visible = ...
End With
///

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Nov 21 '05 #7
Herfried,

See below
\\\
Dim delayarray As New ArrayList
For inti As Integer = 0 To 99
delayarray.Add(New TextBox)
Me.Controls.Add(DirectCast(delayarray(inti), TextBox))
DirectCast(delayarray(inti), TextBox).Name = "MyTextBox" &
inti.ToString
DirectCast(delayarray(inti), TextBox).Location = New Point(56, inti *
10 + 64)
DirectCast(delayarray(inti), TextBox).Visible = True


I'd try to get rid of the 'DirectCast's:

\\\
With DirectCast(delayarray(inti), TextBox)
.Name = ...
.Location = ...
.Visible = ...
End With
///

I find "With" ugly, I know maybe personal, however when it are a lot I would
just do
\\\
dim thistextbox as textbox = directcast(Delayarray(inti),Textbox)
thistextbox.name = ....
thistextbox.location = .....
thistextbox.visible = ....
////.

Cor
Nov 21 '05 #8
"Cor Ligthert" <no************@planet.nl> schrieb:
I'd try to get rid of the 'DirectCast's:

\\\
With DirectCast(delayarray(inti), TextBox)
.Name = ...
.Location = ...
.Visible = ...
End With
///

I find "With" ugly, I know maybe personal, however when it are a lot I
would just do
\\\
dim thistextbox as textbox = directcast(Delayarray(inti),Textbox)
thistextbox.name = ....
thistextbox.location = .....
thistextbox.visible = ....
////.


That's personal preference. I didn't use a variable because in this case a
name IMO doesn't add a benefit. My intention to reply was to show a way
that might have a better performance and less "redundancy" in the code ;-).

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Nov 21 '05 #9
Herfried,
That's personal preference. I didn't use a variable because in this case
a name IMO doesn't add a benefit. My intention to reply was to show a way
that might have a better performance and less "redundancy" in the code
;-).


The "with" has no better performance where you got that idea?
Typing less characters has nothing to do with redundancy or performance.

In all ways it should be exactly the same intermidiate code.

Although you use more rows of code does that as well affects nothing.

Where did you get that idea that "with" will give any better runtime
performance?

Cor


Nov 21 '05 #10
"Cor Ligthert" <no************@planet.nl> schrieb:
That's personal preference. I didn't use a variable because in this case
a name IMO doesn't add a benefit. My intention to reply was to show a
way that might have a better performance and less "redundancy" in the
code ;-).
The "with" has no better performance where you got that idea?
Typing less characters has nothing to do with redundancy or performance.


Sure it has. The cast only needs to be done once opposed to casting every
time you access the object. Other sample:

\\\
Me.Foo(100).Bar("Goo").GetSomething(1).ID = 120
Me.Foo(100).Bar("Goo").GetSomething(1).Name = "Bla"
....
///

vs.

\\\
With Me.Foo(100).Bar("Goo").GetSomething(1)
.ID = 120
.Name = "Bla"
...
End With
///

Notice that the latter solution will have approx. the same "performance" as
your solution with the variable.
In all ways it should be exactly the same intermidiate code.
No!

Sample:

\\\
Public Sub A()
DirectCast(Me, Form1).Enabled = False
DirectCast(Me, Form1).Height = 120
End Sub

Public Sub B()
With DirectCast(Me, Form1)
.Enabled = False
.Height = 120
End With
End Sub
///

.... corresponding MSIL:

\\\
..method public instance void A() cil managed
{
// Codegröße 30 (0x1e)
.maxstack 8
IL_0000: nop
IL_0001: ldarg.0
IL_0002: castclass WindowsApplication3.Form1
IL_0007: ldc.i4.0
IL_0008: callvirt instance void
[System.Windows.Forms]System.Windows.Forms.Control::set_Enabled(bool)
IL_000d: nop
IL_000e: ldarg.0
IL_000f: castclass WindowsApplication3.Form1
IL_0014: ldc.i4.s 120
IL_0016: callvirt instance void
[System.Windows.Forms]System.Windows.Forms.Control::set_Height(int32)
IL_001b: nop
IL_001c: nop
IL_001d: ret
} // end of method Form1::A

..method public instance void B() cil managed
{
// Codegröße 29 (0x1d)
.maxstack 2
.locals init ([0] class WindowsApplication3.Form1 _Vb_t_ref_0)
IL_0000: nop
IL_0001: ldarg.0
IL_0002: castclass WindowsApplication3.Form1
IL_0007: stloc.0
IL_0008: ldloc.0
IL_0009: ldc.i4.0
IL_000a: callvirt instance void
[System.Windows.Forms]System.Windows.Forms.Control::set_Enabled(bool)
IL_000f: nop
IL_0010: ldloc.0
IL_0011: ldc.i4.s 120
IL_0013: callvirt instance void
[System.Windows.Forms]System.Windows.Forms.Control::set_Height(int32)
IL_0018: nop
IL_0019: ldnull
IL_001a: stloc.0
IL_001b: nop
IL_001c: ret
} // end of method Form1::B
///

In 'A' there are two 'castclass' operations.
Where did you get that idea that "with" will give any better runtime
performance?


.... by understanding 'With' and type casts ;-).

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Nov 21 '05 #11
"Cor Ligthert" <no************@planet.nl> schrieb:
That's personal preference. I didn't use a variable because in this case
a name IMO doesn't add a benefit. My intention to reply was to show a
way that might have a better performance and less "redundancy" in the
code ;-).
The "with" has no better performance where you got that idea?
Typing less characters has nothing to do with redundancy or performance.


Sure it has. The cast only needs to be done once opposed to casting every
time you access the object. Other sample:

\\\
Me.Foo(100).Bar("Goo").GetSomething(1).ID = 120
Me.Foo(100).Bar("Goo").GetSomething(1).Name = "Bla"
....
///

vs.

\\\
With Me.Foo(100).Bar("Goo").GetSomething(1)
.ID = 120
.Name = "Bla"
...
End With
///

Notice that the latter solution will have approx. the same "performance" as
your solution with the variable.
In all ways it should be exactly the same intermidiate code.
No!

Sample:

\\\
Public Sub A()
DirectCast(Me, Form1).Enabled = False
DirectCast(Me, Form1).Height = 120
End Sub

Public Sub B()
With DirectCast(Me, Form1)
.Enabled = False
.Height = 120
End With
End Sub
///

.... corresponding MSIL:

\\\
..method public instance void A() cil managed
{
// Codegröße 30 (0x1e)
.maxstack 8
IL_0000: nop
IL_0001: ldarg.0
IL_0002: castclass WindowsApplication3.Form1
IL_0007: ldc.i4.0
IL_0008: callvirt instance void
[System.Windows.Forms]System.Windows.Forms.Control::set_Enabled(bool)
IL_000d: nop
IL_000e: ldarg.0
IL_000f: castclass WindowsApplication3.Form1
IL_0014: ldc.i4.s 120
IL_0016: callvirt instance void
[System.Windows.Forms]System.Windows.Forms.Control::set_Height(int32)
IL_001b: nop
IL_001c: nop
IL_001d: ret
} // end of method Form1::A

..method public instance void B() cil managed
{
// Codegröße 29 (0x1d)
.maxstack 2
.locals init ([0] class WindowsApplication3.Form1 _Vb_t_ref_0)
IL_0000: nop
IL_0001: ldarg.0
IL_0002: castclass WindowsApplication3.Form1
IL_0007: stloc.0
IL_0008: ldloc.0
IL_0009: ldc.i4.0
IL_000a: callvirt instance void
[System.Windows.Forms]System.Windows.Forms.Control::set_Enabled(bool)
IL_000f: nop
IL_0010: ldloc.0
IL_0011: ldc.i4.s 120
IL_0013: callvirt instance void
[System.Windows.Forms]System.Windows.Forms.Control::set_Height(int32)
IL_0018: nop
IL_0019: ldnull
IL_001a: stloc.0
IL_001b: nop
IL_001c: ret
} // end of method Form1::B
///

In 'A' there are two 'castclass' operations.
Where did you get that idea that "with" will give any better runtime
performance?


.... by understanding 'With' and type casts ;-).

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Nov 21 '05 #12

"Herfried K. Wagner [MVP]"
... by understanding 'With' and type casts ;-).


Will you than explain the ils from main beneath of this sample for me?.

\\\testprogram
Public Class thisClass
Public Shared Sub main()
Dim we As New mytopclass
we = New mysubclass
Dim comments As String = "Start of Directcast"
comments = DirectCast(we, mysubclass).he
comments = "Start of With"
With DirectCast(we, mysubclass)
comments = .he
End With
comments = "Start of setting an adress holder"
Dim c1 As mysubclass = DirectCast(we, mysubclass)
comments = c1.he
comments = "End comments"
End Sub
End Class
Public Class mytopclass
End Class
Public Class mysubclass
Inherits mytopclass
Public Shared ReadOnly Property he() As String
Get
Return "Herfried"
End Get
End Property
End Class
///
\\\Ils from the mainmethode for this
..method public static void main() cil managed
{
.entrypoint
.custom instance void [mscorlib]System.STAThreadAttribute::.ctor() = ( 01
00 00 00 )
// Code size 71 (0x47)
.maxstack 1
.locals init (class WindowsApplication3.mysubclass V_0,
string V_1,
class WindowsApplication3.mytopclass V_2,
class WindowsApplication3.mysubclass V_3)
IL_0000: newobj instance void WindowsApplication3.mytopclass::.ctor()
IL_0005: stloc.2
IL_0006: newobj instance void WindowsApplication3.mysubclass::.ctor()
IL_000b: stloc.2
IL_000c: ldstr "Start of Directcast"
IL_0011: stloc.1
IL_0012: call string WindowsApplication3.mysubclass::get_he()
IL_0017: stloc.1
IL_0018: ldstr "Start of With"
IL_001d: stloc.1
IL_001e: ldloc.2
IL_001f: castclass WindowsApplication3.mysubclass
IL_0024: stloc.3
IL_0025: call string WindowsApplication3.mysubclass::get_he()
IL_002a: stloc.1
IL_002b: ldnull
IL_002c: stloc.3
IL_002d: ldstr "Start of setting an adress holder"
IL_0032: stloc.1
IL_0033: ldloc.2
IL_0034: castclass WindowsApplication3.mysubclass
IL_0039: stloc.0
IL_003a: call string WindowsApplication3.mysubclass::get_he()
IL_003f: stloc.1
IL_0040: ldstr "End comments"
IL_0045: stloc.1
IL_0046: ret
} // end of method thisClass::main
///

Do not ask me to explain it, I did not make that statement as you.

Cor


Nov 21 '05 #13

"Herfried K. Wagner [MVP]"
... by understanding 'With' and type casts ;-).


Will you than explain the ils from main beneath of this sample for me?.

\\\testprogram
Public Class thisClass
Public Shared Sub main()
Dim we As New mytopclass
we = New mysubclass
Dim comments As String = "Start of Directcast"
comments = DirectCast(we, mysubclass).he
comments = "Start of With"
With DirectCast(we, mysubclass)
comments = .he
End With
comments = "Start of setting an adress holder"
Dim c1 As mysubclass = DirectCast(we, mysubclass)
comments = c1.he
comments = "End comments"
End Sub
End Class
Public Class mytopclass
End Class
Public Class mysubclass
Inherits mytopclass
Public Shared ReadOnly Property he() As String
Get
Return "Herfried"
End Get
End Property
End Class
///
\\\Ils from the mainmethode for this
..method public static void main() cil managed
{
.entrypoint
.custom instance void [mscorlib]System.STAThreadAttribute::.ctor() = ( 01
00 00 00 )
// Code size 71 (0x47)
.maxstack 1
.locals init (class WindowsApplication3.mysubclass V_0,
string V_1,
class WindowsApplication3.mytopclass V_2,
class WindowsApplication3.mysubclass V_3)
IL_0000: newobj instance void WindowsApplication3.mytopclass::.ctor()
IL_0005: stloc.2
IL_0006: newobj instance void WindowsApplication3.mysubclass::.ctor()
IL_000b: stloc.2
IL_000c: ldstr "Start of Directcast"
IL_0011: stloc.1
IL_0012: call string WindowsApplication3.mysubclass::get_he()
IL_0017: stloc.1
IL_0018: ldstr "Start of With"
IL_001d: stloc.1
IL_001e: ldloc.2
IL_001f: castclass WindowsApplication3.mysubclass
IL_0024: stloc.3
IL_0025: call string WindowsApplication3.mysubclass::get_he()
IL_002a: stloc.1
IL_002b: ldnull
IL_002c: stloc.3
IL_002d: ldstr "Start of setting an adress holder"
IL_0032: stloc.1
IL_0033: ldloc.2
IL_0034: castclass WindowsApplication3.mysubclass
IL_0039: stloc.0
IL_003a: call string WindowsApplication3.mysubclass::get_he()
IL_003f: stloc.1
IL_0040: ldstr "End comments"
IL_0045: stloc.1
IL_0046: ret
} // end of method thisClass::main
///

Do not ask me to explain it, I did not make that statement as you.

Cor


Nov 21 '05 #14
Cor,

"Cor Ligthert" <no************@planet.nl> schrieb:
... by understanding 'With' and type casts ;-).


Will you than explain the ils from main beneath of this sample for me?.

\\\testprogram
Public Class thisClass
Public Shared Sub main()
Dim we As New mytopclass
we = New mysubclass
Dim comments As String = "Start of Directcast"
comments = DirectCast(we, mysubclass).he
comments = "Start of With"
With DirectCast(we, mysubclass)
comments = .he
End With
comments = "Start of setting an adress holder"
Dim c1 As mysubclass = DirectCast(we, mysubclass)
comments = c1.he
comments = "End comments"
End Sub
End Class
Public Class mytopclass
End Class
Public Class mysubclass
Inherits mytopclass
Public Shared ReadOnly Property he() As String
Get
Return "Herfried"
End Get
End Property
End Class


Remove the 'Shared' from the 'he' property and take a look at the IL again.
Otherwise you cannot compare your sample with the situation we are
discussing.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Nov 21 '05 #15
Cor,

"Cor Ligthert" <no************@planet.nl> schrieb:
... by understanding 'With' and type casts ;-).


Will you than explain the ils from main beneath of this sample for me?.

\\\testprogram
Public Class thisClass
Public Shared Sub main()
Dim we As New mytopclass
we = New mysubclass
Dim comments As String = "Start of Directcast"
comments = DirectCast(we, mysubclass).he
comments = "Start of With"
With DirectCast(we, mysubclass)
comments = .he
End With
comments = "Start of setting an adress holder"
Dim c1 As mysubclass = DirectCast(we, mysubclass)
comments = c1.he
comments = "End comments"
End Sub
End Class
Public Class mytopclass
End Class
Public Class mysubclass
Inherits mytopclass
Public Shared ReadOnly Property he() As String
Get
Return "Herfried"
End Get
End Property
End Class


Remove the 'Shared' from the 'he' property and take a look at the IL again.
Otherwise you cannot compare your sample with the situation we are
discussing.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Nov 21 '05 #16
Herfried,

I did already not understood why that first casting was not done.

Of course if it is about less than 3 settings probably faster to use the
directcast directly and with more equily and than not the method with "with"
however the reference setting as I showed. (However I would not even talk
about that)

And now I understand what you mean, can you explain how many minutes there
will be gained with this, assuming with building one form as in this sample?

:-) (not angry of course laughing)

Cor
\\\
..method public static void main() cil managed
{
.entrypoint
.custom instance void [mscorlib]System.STAThreadAttribute::.ctor() = ( 01
00 00 00 )
// Code size 79 (0x4f)
.maxstack 1
.locals init (class WindowsApplication3.mysubclass V_0,
string V_1,
class WindowsApplication3.mytopclass V_2,
class WindowsApplication3.mysubclass V_3)
IL_0000: newobj instance void WindowsApplication3.mytopclass::.ctor()
IL_0005: stloc.2
IL_0006: newobj instance void WindowsApplication3.mysubclass::.ctor()
IL_000b: stloc.2
IL_000c: ldstr "Start of Directcast"
IL_0011: stloc.1
IL_0012: ldloc.2
IL_0013: castclass WindowsApplication3.mysubclass
IL_0018: callvirt instance string
WindowsApplication3.mysubclass::get_he()
IL_001d: stloc.1
IL_001e: ldstr "Start of With"
IL_0023: stloc.1
IL_0024: ldloc.2
IL_0025: castclass WindowsApplication3.mysubclass
IL_002a: stloc.3
IL_002b: ldloc.3
IL_002c: callvirt instance string
WindowsApplication3.mysubclass::get_he()
IL_0031: stloc.1
IL_0032: ldnull
IL_0033: stloc.3
IL_0034: ldstr "Start of setting an adress holder"
IL_0039: stloc.1
IL_003a: ldloc.2
IL_003b: castclass WindowsApplication3.mysubclass
IL_0040: stloc.0
IL_0041: ldloc.0
IL_0042: callvirt instance string
WindowsApplication3.mysubclass::get_he()
IL_0047: stloc.1
IL_0048: ldstr "End comments"
IL_004d: stloc.1
IL_004e: ret
} // end of method thisClass::main
///
Nov 21 '05 #17
Herfried,

I did already not understood why that first casting was not done.

Of course if it is about less than 3 settings probably faster to use the
directcast directly and with more equily and than not the method with "with"
however the reference setting as I showed. (However I would not even talk
about that)

And now I understand what you mean, can you explain how many minutes there
will be gained with this, assuming with building one form as in this sample?

:-) (not angry of course laughing)

Cor
\\\
..method public static void main() cil managed
{
.entrypoint
.custom instance void [mscorlib]System.STAThreadAttribute::.ctor() = ( 01
00 00 00 )
// Code size 79 (0x4f)
.maxstack 1
.locals init (class WindowsApplication3.mysubclass V_0,
string V_1,
class WindowsApplication3.mytopclass V_2,
class WindowsApplication3.mysubclass V_3)
IL_0000: newobj instance void WindowsApplication3.mytopclass::.ctor()
IL_0005: stloc.2
IL_0006: newobj instance void WindowsApplication3.mysubclass::.ctor()
IL_000b: stloc.2
IL_000c: ldstr "Start of Directcast"
IL_0011: stloc.1
IL_0012: ldloc.2
IL_0013: castclass WindowsApplication3.mysubclass
IL_0018: callvirt instance string
WindowsApplication3.mysubclass::get_he()
IL_001d: stloc.1
IL_001e: ldstr "Start of With"
IL_0023: stloc.1
IL_0024: ldloc.2
IL_0025: castclass WindowsApplication3.mysubclass
IL_002a: stloc.3
IL_002b: ldloc.3
IL_002c: callvirt instance string
WindowsApplication3.mysubclass::get_he()
IL_0031: stloc.1
IL_0032: ldnull
IL_0033: stloc.3
IL_0034: ldstr "Start of setting an adress holder"
IL_0039: stloc.1
IL_003a: ldloc.2
IL_003b: castclass WindowsApplication3.mysubclass
IL_0040: stloc.0
IL_0041: ldloc.0
IL_0042: callvirt instance string
WindowsApplication3.mysubclass::get_he()
IL_0047: stloc.1
IL_0048: ldstr "End comments"
IL_004d: stloc.1
IL_004e: ret
} // end of method thisClass::main
///
Nov 21 '05 #18
Cor,

"Cor Ligthert" <no************@planet.nl> schrieb
I did already not understood why that first casting was not done.
I didn't understand that too, but then I saw the 'Shared' ;-).
Of course if it is about less than 3 settings probably faster to use the
directcast directly and with more equily and than not the method with
"with" however the reference setting as I showed. (However I would not
even talk about that)
As said before, it's all about personal preference. Using a variable or
'With' makes maintainance easier and will save time when typing code, plus a
small speed benefit. Sure, that doesn't really matter...
:-) (not angry of course laughing)


:-)))

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Nov 21 '05 #19
Cor,

"Cor Ligthert" <no************@planet.nl> schrieb
I did already not understood why that first casting was not done.
I didn't understand that too, but then I saw the 'Shared' ;-).
Of course if it is about less than 3 settings probably faster to use the
directcast directly and with more equily and than not the method with
"with" however the reference setting as I showed. (However I would not
even talk about that)
As said before, it's all about personal preference. Using a variable or
'With' makes maintainance easier and will save time when typing code, plus a
small speed benefit. Sure, that doesn't really matter...
:-) (not angry of course laughing)


:-)))

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Nov 21 '05 #20

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Tek9_AK | last post by:
I need to find a way to transfer all the values of an array inside a function out of the fuction into another array. IE function splice($filename){ if(file_exists($filename)){...
0
by: claudel | last post by:
Hi I have a newb PHP/Javascript question regarding checkbox processing I'm not sure which area it falls into so I crossposted to comp.lang.php and comp.lang.javascript. I'm trying to...
3
by: John Howard | last post by:
I'm working on my homework for C++, and have a problem. I have a multi-dimension array, Array1 that I can't define in the function declaration and function definition. I keep getting an error. ...
2
by: CES | last post by:
All, Sorry for the 101 question but I can't figure out how to return all of the contents of an array to another function. I been able to figure out how to return individual elements of the array...
74
by: Michael | last post by:
As if we needed another string reversal question. I have a problem with the following code, that I believe should work. int StringReverse(char* psz) { char *p = psz; char *q = psz +...
7
by: Squignibbler | last post by:
Hi all, I have a question regarding the C++ programming language regarding the nature of the relationship between pointers and arrays. If the statement MyArray is functionally identical to...
8
by: Paul Cochrane | last post by:
Hi all, I've got an application that I'm writing that autogenerates python code which I then execute with exec(). I know that this is not the best way to run things, and I'm not 100% sure as to...
11
by: Sensei | last post by:
Hi again! I have ``yet another silly question'', about arrays this time. I've looked through the FAQs in the array & memory sections without finding an answer. I surely didn't look deep enough. ...
14
by: rohitkumar | last post by:
this is my code to calculate the sum of digits in a number for eg. 432567 sum =4+3+2+5+6+7=27 i 'm using turboc++ compiler from borland and i 'm runing my program on DOS. ...
11
TTCEric
by: TTCEric | last post by:
This will be original. I promise. I cannot get the random number generator to work. I tried seeding with Date.Now.Milliseconds, it still results in the same values. What I have are arrays...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.