473,508 Members | 2,281 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Unloading a button at runtime

Lou
I need to unload a button that was created during runtime but keep getting
an error that
"Option Strict disallows operands of Type object for operator"=". Use the is
operator.

Here is my code
======================================

'Remove all old buttons

For i = 0 To Me.Controls.Count - 1

If TypeOf (Me.Controls(i)) Is Button Then

If Me.Controls(i).Tag = "MyButton" Then

End If

End If

Next i

==============================

Thanks

-Lou
Feb 8 '07 #1
5 991
"Lou" <lo********@comcast.netschrieb
I need to unload a button that was created during runtime but keep
getting an error that
"Option Strict disallows operands of Type object for operator"=".
Use the is operator.

Here is my code
======================================

'Remove all old buttons

For i = 0 To Me.Controls.Count - 1

If TypeOf (Me.Controls(i)) Is Button Then

If Me.Controls(i).Tag = "MyButton" Then

End If

End If

Next i

==============================
The type of the Tag property is System.Object. You can not use the "="
operator to compare any object with a String. If you know that all Tag
properties reference a String, you can use:

If Me.Controls(i).Tag.ToString = "MyButton" Then
Armin

Feb 8 '07 #2
But you see how nice I have showed your method to everybody, sometimes
telling it is the method Armin Zingler.

:-)

Cor
Feb 8 '07 #3
Lou
That didn't work either. It still crashes?
"Cor Ligthert [MVP]" <no************@planet.nlwrote in message
news:uh**************@TK2MSFTNGP06.phx.gbl...
But you see how nice I have showed your method to everybody, sometimes
telling it is the method Armin Zingler.

:-)

Cor

Feb 8 '07 #4
Lou
This does not work:

Dim i As Integer

Dim ctrl As Button

For i = 0 To PanelMiddle.Controls.Count

If TypeOf (PanelMiddle.Controls(i)) Is Button Then

ctrl = CType(PanelMiddle.Controls(i), Button)

If ctrl.Tag.ToString = btn.Key.ToString Then

PanelMiddle.Controls(i).Text = btn.Key

End If

End If

Next i

"Cor Ligthert [MVP]" <no************@planet.nlwrote in message
news:uh**************@TK2MSFTNGP06.phx.gbl...
But you see how nice I have showed your method to everybody, sometimes
telling it is the method Armin Zingler.

:-)

Cor

Feb 8 '07 #5
"Lou" <lo********@comcast.netschrieb
This does not work:
"not work" means what? Maybe a NullReferenceException?
Dim i As Integer

Dim ctrl As Button

For i = 0 To PanelMiddle.Controls.Count
For i = 0 To PanelMiddle.Controls.Count - 1

If TypeOf (PanelMiddle.Controls(i)) Is Button Then

ctrl = CType(PanelMiddle.Controls(i), Button)

If ctrl.Tag.ToString = btn.Key.ToString Then

PanelMiddle.Controls(i).Text = btn.Key

End If

End If

Next i
Did you consider "If you know that all Tag properties reference a String".
Is this the case?
Armin

Feb 8 '07 #6

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

Similar topics

9
4412
by: Rom Marshall | last post by:
Hi. Once a LOB size goes beyond 32KB in size, I'm not able to use the LOAD utility to unload the data off the tables for DB2 7.1 on OS/390. Instead, the documentation refers to a sample C++...
2
1591
by: Guru Prasad | last post by:
Is there a delay involved in unloading assemblies once a virtual directory is "deleted" using IIS Manager ? At times even after the virtual directory is removed i cannot delete the backing physical...
2
4201
by: RajaKannan | last post by:
Hi All, I have a form in which i have few mandatory fields. Wheneve the user tries to save, i check for these fields and alert them, if thet are empty. I have a CLOSE button in my form and...
0
1228
by: tamasumalta | last post by:
I have done some code to load a picture in an array of bytes. The data is saved in a file in the Hard drive. There is also another piece of code to display the image. My issue is that I need to...
1
1469
by: jesusdiehard | last post by:
hi guys, i have a situation such that i made a dll using wsdl and load that dll at runtime in .Net(C#). Now i want to delete that dll somehow. for this i have to unload that dll. can anybody help...
2
5548
by: Tim | last post by:
Hello, I've finally managed to remotely load a DLL. I've expanded the code to load it in a seperate domain to unload the appdomain, which works to a certain extend. The host application always...
8
2072
by: ARC | last post by:
Hmmm...This is interesting. While reading info on packaging an Access 2007 runtime app, it's mentioned that a file such as, .accde (mde for 2007) will be changed to .accdr, where the final r means...
3
2462
by: =?Utf-8?B?c2FtMDFt?= | last post by:
Using Composite Application Block UI, is it possible to unload a module. Looking into the ModuleLoaderService I can see a Load method, but how can I gracefully close a module? I have a custom...
0
1289
vdraceil
by: vdraceil | last post by:
Hi,i use VB6.0..is it possible to prevent a form from unloading ever? I know to set cancel=true in query unload event of the form..but this applies only to limited cases. If my exe is closed from...
0
7225
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7382
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7495
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5627
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5052
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3193
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3181
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1556
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
766
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.