473,666 Members | 2,116 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.Cou nt - 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 1002
"Lou" <lo********@com cast.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.Cou nt - 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******** ******@TK2MSFTN GP06.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.Con trols.Count

If TypeOf (PanelMiddle.Co ntrols(i)) Is Button Then

ctrl = CType(PanelMidd le.Controls(i), Button)

If ctrl.Tag.ToStri ng = btn.Key.ToStrin g Then

PanelMiddle.Con trols(i).Text = btn.Key

End If

End If

Next i

"Cor Ligthert [MVP]" <no************ @planet.nlwrote in message
news:uh******** ******@TK2MSFTN GP06.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********@com cast.netschrieb
This does not work:
"not work" means what? Maybe a NullReferenceEx ception?
Dim i As Integer

Dim ctrl As Button

For i = 0 To PanelMiddle.Con trols.Count
For i = 0 To PanelMiddle.Con trols.Count - 1

If TypeOf (PanelMiddle.Co ntrols(i)) Is Button Then

ctrl = CType(PanelMidd le.Controls(i), Button)

If ctrl.Tag.ToStri ng = btn.Key.ToStrin g Then

PanelMiddle.Con trols(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
4423
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++ program -- DSN710.SDSNSAMP(DSN8DLPL) to use for this purpose. I'm wondering if anyone out there has a COBOL equivalent to this as I do not have a C++ compiler?
2
1603
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 directory and it looks like ASPNET runtime is holding on to the assemblies. Once i recycle the ASPNET process, i can delete this directory. Has this got anything to do with strong-named/signed assemblies ( even though deployed as private...
2
4213
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 whenever the user clicks the CLOSE button, i ask the user whether he wants to save before closing the form. On the Form_Unload event, i check whether there are any new changes and if yes, i pompt the user for a save. But if they have not filled any of...
0
1239
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 unload the picture before the user press the button to refresh and therefore reload the image. Generally I would have an error when I try to download the file and save it. I will have an error that the file is being used by another process. Noticed...
1
1511
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 me how unload the loaded dll. thanx in advance.
2
5554
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 keeps the entry DLL in memory. How can I also unload this main DLL? As it's left after unloading the appdomain. The dll is loaded in the hostapplication at "Assembly assembly = appdom.Load(RawAssembly)".
8
2083
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 runtime. I assume by changing the extension manually yourself from the .accde to accdr you can then simulate the runtime (instead of the old way of using the /runtime switch). I tried this, and it works. When you double-click the ..accdr, it...
3
2473
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 module loader, which reads from a database, creates a button for each module, and loads modules OnDemand. Some of the modules add-in Menu items via UIExtension Sites. If I were to just find the WorkItem by way of something like:...
0
1300
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 the task manager-"Applications" tab,i can detect it and prevent it from unloading,but if it is closed from the task manager-"Processes" tab,the form will be closed even without passing through the terminate,queryunload and unload events... I'm...
0
8356
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8871
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8781
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
6198
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5664
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4198
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4369
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2771
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 we have to send another system
2
1776
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.