I have app in which I would like to use buttons as an Drop Down menu. - private void button16_Click(object sender, EventArgs e)
-
{
-
button1.Visible = true;
-
button2.Visible = true;
-
button3.Visible = true;
-
button4.Visible = true;
-
button5.Visible = true;
-
button6.Visible = true;
-
button7.Visible = true;
-
button8.Visible = true;
-
button9.Visible = true;
-
button10.Visible = true;
-
button11.Visible = true;
-
button12.Visible = true;
-
button13.Visible = true;
-
button14.Visible = true;
-
button15.Visible = true;
-
}
-
-
private void button17_Click(object sender, EventArgs e)
-
{
-
button1.Visible = false;
-
button2.Visible = false;
-
button3.Visible = false;
-
button4.Visible = false;
-
button5.Visible = false;
-
button6.Visible = false;
-
button7.Visible = false;
-
button8.Visible = false;
-
button9.Visible = false;
-
button10.Visible = false;
-
button11.Visible = false;
-
button12.Visible = false;
-
button13.Visible = false;
-
button14.Visible = false;
-
button15.Visible = false;
-
}
All is working but turning buttons invisible again is really slow, turning them visible is completed in milliseconds while turning them invisible takes about 2-3 seconds.
How can I speed that up?
9 6568
put it in a groupbox and instead of hiding and showing the buttons individually, hide the groupbox, will only require one process and therefore should be quicker, in theory
edit: though on second thoughts its the drawing it to the UI thats eating up the time, which would still be a problem with hiding and showing the groupbox
Puting them in groupBox helped but now it's not pretty :P
I still don't understand if drawing is the problem how is it easier to draw them(make them visible) then destroy them (make them invisible)
Plater 7,872
Recognized Expert Expert
Do you have event handlers attached to the visible state changes on any of the buttons?
try the code as
this.button1.Vi sible = false;
for every button
@Plater
How do you mean?
I have EventHandlers for button.Click for what would I need it for Visible state? (Like I've said it's a Menu so I just need that Buttons are shown when I click on button that's always visible and that they disappear when I click on another+it makes visible another set of buttons)
If you click on the form and click one of the buttons then look in its properties window, click the lightning bolt (that takes you to that controls events) one of them will be VisibleChanged, this is code that is fired when the buttons visibility is changed from true to false or vice versa, i'm not sure how this event would help as the same code would need to be executed anyway and you would still have the same problem of it being slow to show them, but thats an explanation of the event anyhow
On a massive side note i just tried to replicate the problem you have, i used 26 buttons instead of your 15, hoping that this would exaggerate your problem, and i didnt have it, it showed just as quickly as it hid. So its nothing with your code, its literally just the speed that your computer is capable of hiding and drawing at (mine is only a month or so old so has next to nothing slowing it down) so yeah the problem is not the code, so you dont need to use the groupbox if you dont want to as there really isnt a way of speeding it up short of formatting your computer!
Thank you for confirmation, computer I'm working on is old, has 1GB of RAM and 2,4 GHz CPU :P
hehe thought it might be that the moment i tried it because i suddenly remembered doing something similar a few projects ago
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Owen Funkhouser |
last post by:
I have a form with three radio options. And I have three buttons:
<input type="submit" name="mainform_action" value="Edit Data">
<input type="submit" name="mainform_action" value="View Data">
<input type="submit" name="mainform_action" value="Delete Data">
If the first radio button is selected, I only want all three buttons to be
visible to the user.
If the second radio button is selected, I only want the "Edit Data" and "View
Data"...
|
by: dzeeq |
last post by:
Hi,
I wonder if it's possible to replace standard text on confirm-popup
buttons from 'ok' and 'cancel' to some other captions.
If not, is there a way to create quickly custom dialog, with only two
buttons, returning 'true' or 'false'? Would I have to use forms to
return value from my custom dialog?
Thanx for any help.
|
by: Paul THompson |
last post by:
I am using IE to hide sections of a form. When I display the first
section (name='ea'), the form widgets are not clickable in IE nor do
they accept focus. When I display the 3rd section (name='ec'), the
items in all sections become clickable/accept focus. Has anyone ever
seen anything like this?
There are no problems at all in NN/Firefox/Mozilla.
Here is some of the code - there is rather a lot, so I just display
some of it:
|
by: DettCom |
last post by:
Hello,
I would like to be able to display or hide fields based on whether a
specific Yes/No radio button is selected. This is in conjunction with
a posting a just made here in the same group related to checkboxes.
Thanks!!!
|
by: sam |
last post by:
I have 2 radio buttons on my form which are hidden. I need to have these radio buttons visible once a checkbox is selected. The radio buttons are hidden on loading of the form but I cannot make them visible once the check box is checked. The error I get is 'document.radiology.rcontmedia.style' is null or not an object. The code I am using is below. Please note that I have no previous experience programming in javascript.
function...
| |
by: COHENMARVIN |
last post by:
I have a table with 2 buttons in it - a SAVE button and a DELETE
button. If Session("BothButtons") = True, I want to show both buttons.
If Session("BothButtons") = False, I want to show only the SAVE button.
This would be easy to do (I just would set DeleteButton.Visible =
False), but the problem is that the 2 buttons are in 2 different cells
of a table, something like this:
<td align="center"><ASP:Button id="Save" runat="server" /></td>...
|
by: AJBopp |
last post by:
I'm wrestling with CSS variations between Firefox and IE. I'm trying to
create rollover buttons in a menu frame. It is working perfectly in
Firefox but in IE only the first button is properly highlighted and
linked. The second button, has only a partial "hit area" at the top of
the image, although if you click the link, you can see the link border
is properly place around the image. The rest of the buttons have no
rolloever state or link...
|
by: Scamjunk |
last post by:
I am a total JavaScript newbie and I got a JavaScript for maintenance
that collapses/expands rows whenever the (-)/(+) GIFs are clicked.
Could it be changed to do the same with radio buttons? on checking of a
radio button the respective row should expand, else remain collapsed.
and if another radio button is chosen then the row originally expanded
should collapse. Is this doable? If so, what should I be changing in
this code?
TIA,
Scam.
|
by: firebirds98 |
last post by:
I have 4 buttons on the start page. The first and last button are set to visible and the two middle buttons are set to false visibility.
<asp:Button ID="btnviewtracks" class="button_schedcontinue" Visible="true" runat="server" Text="View Tracks >>" /><br />
<asp:Button ID="btnRequestClass" class="button_schedcontinue" runat="server" Visible="False" Text="Update Status" AutoPostBack="True" /> <br />
...
|
by: satyabhaskar |
last post by:
hi all,
In my web page i have created radio buttons dynamically on to the page .....following is my code
string Course, Semester, Section;
int rowsCount;
string con = ConfigurationManager.ConnectionStrings.ConnectionString;
protected void Page_Load(object sender, EventArgs e)
{
try
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
| |
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,...
|
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...
|
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
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...
|
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...
| |
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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
| |