Hello,
I'm writing a usercontrol that contains a property named "disabled". It
is set to false by default but there is also another button in the
usercontrol that'll set it to true.
On the main form a number of them are displayed. During the On_Load
event, 1) It'll check to see if the usercontrol is disabled. If true, the
row containing the usercontrol is hidden.
2) If all these usercontrols are disabled, the main form will redirect the
user to another form.
Here is my problem: Although I've successfully implemented (1) by
directly invoke "parent.vis ible = false" in the disablebutton_c lick event, I
couldn't find way to do checking (2) that won't let the usercontrol directly
call methods in the main form.
If I do the checking (2) in Form_load() of the main form, the form won't
redirect until a second refresh so a blank page will be displayed. Seems
that I have to put the code in other event but I have no idea. Can anyone
suggest what I should do to fix it?
Any help would be appreciated.
Regards,
Lau Lei Cheong 2 1241
Slap a panel on the user control and set it to Visible = false. You can then
set the enabled property to allow the panel to be shown. This is the easiest
method, considering the architecture you describe.
--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA
*************** *************** *************** ***
Think Outside the Box!
*************** *************** *************** ***
"Lau Lei Cheong" <la****@yahoo.c om.hk> wrote in message
news:us******** ******@TK2MSFTN GP09.phx.gbl... Hello,
I'm writing a usercontrol that contains a property named "disabled".
It is set to false by default but there is also another button in the usercontrol that'll set it to true.
On the main form a number of them are displayed. During the On_Load event, 1) It'll check to see if the usercontrol is disabled. If true, the row containing the usercontrol is hidden.
2) If all these usercontrols are disabled, the main form will redirect
the user to another form.
Here is my problem: Although I've successfully implemented (1) by directly invoke "parent.vis ible = false" in the disablebutton_c lick event,
I couldn't find way to do checking (2) that won't let the usercontrol
directly call methods in the main form.
If I do the checking (2) in Form_load() of the main form, the form
won't redirect until a second refresh so a blank page will be displayed. Seems that I have to put the code in other event but I have no idea. Can anyone suggest what I should do to fix it?
Any help would be appreciated.
Regards, Lau Lei Cheong
Perheps there's something to clarify.
I have no problem hiding the controls(that is 1) but I have problem
redirecting the page to a new URL if all control is hid(that is 2 and is
what I want to ask).
I found that I cannot check for the redirection in Form_Load because it
seems the events of main form will run earlier then the usercontrol's
event.(while I thought the control.click event will always be earlier than
the Form_Loads...)
"Cowboy" <No************ @comcast.netNoS pamM> ¦b¶l¥ó
news:OL******** ******@TK2MSFTN GP12.phx.gbl ¤¤¼¶¼g... Slap a panel on the user control and set it to Visible = false. You can
then set the enabled property to allow the panel to be shown. This is the
easiest method, considering the architecture you describe.
-- Gregory A. Beamer MVP; MCP: +I, SE, SD, DBA
*************** *************** *************** *** Think Outside the Box! *************** *************** *************** *** "Lau Lei Cheong" <la****@yahoo.c om.hk> wrote in message news:us******** ******@TK2MSFTN GP09.phx.gbl... Hello,
I'm writing a usercontrol that contains a property named "disabled". It is set to false by default but there is also another button in the usercontrol that'll set it to true.
On the main form a number of them are displayed. During the On_Load event, 1) It'll check to see if the usercontrol is disabled. If true,
the row containing the usercontrol is hidden.
2) If all these usercontrols are disabled, the main form will redirect the user to another form.
Here is my problem: Although I've successfully implemented (1) by directly invoke "parent.vis ible = false" in the disablebutton_c lick
event, I couldn't find way to do checking (2) that won't let the usercontrol directly call methods in the main form.
If I do the checking (2) in Form_load() of the main form, the form won't redirect until a second refresh so a blank page will be displayed. Seems that I have to put the code in other event but I have no idea. Can
anyone suggest what I should do to fix it?
Any help would be appreciated.
Regards, Lau Lei Cheong
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: R.Wieser |
last post by:
Hello All,
I'm trying to get a "Virtual Listbox" to work. I've currently got a form,
and used CreateWindowExA to create a ListBox with the LBS_OWNERDRAWFIXED and
LBS_NODATA flags on it. I've allso subclassed the window and do see all
kinds of WS_??? messages coming by.
But now I'm stuck :-\
I've got *no* idea what to do next, and all my searching on the web leads me
|
by: Jose Michael Meo R. Barrido |
last post by:
I made a custom runded rectangle usercontrol. I used a function i found on
the internet. the function works fine(see "GetRoundRect" below).
I use the fullowing code to make my usercontrol rounded....
*****************************************************
Protected Overrides Sub OnPaint(ByVal e As
System.Windows.Forms.PaintEventArgs)
Dim x1 As Integer = 0
Dim x2 As Integer = Me.ClientSize.Width
Dim iHeight As Int32 = Me.Height
Dim...
|
by: Tee |
last post by:
Hi,
I have a base usercontrol with a method (blank method, no code), I have
another few usercontrols that will inherit this base usercontrol, but I want
to force all the usercontrol that inheriting this base usercontrol to
override the method with its own code. How do I do it?
I have tried to make the base usercontrol an abstract class (mustinherits +
mustoverrides), this works, but all the usercontrols that inherit it will
not able...
|
by: krishnan |
last post by:
Hi all
I have a custom usercontrol in my window form "frmsett.cs" .
"initializecomponents" of "frmsett.cs" initialises usercontrol
This usercontrol is derived from a base component class.
Usercontrol populates printer informations.
we populate default printer related informations to usercontrol through
Pinfo() method (a function in base component class )
|
by: Philipp Lenz |
last post by:
I'm very confused about how this works, all the tutorials out there
show me how to apply a skin to a webcontrol, but I want to know how
I can access the components of a control....for example:
I have a usercontrol, the ascx is defined like this:
<%@ Control Language="C#" AutoEventWireup="true"
CodeFile="Test.ascx.cs" Inherits="Spin.Test" %>
<asp:Panel ID="Panel1" runat="server" Height="243px" Width="350px">
| |
by: Ronald S. Cook |
last post by:
We have a Windows app that has one main form (a shell, sort of). We then
load user controls into a panel on the form depending on what the user has
selected.
Our current code to unload the existing user control and load the newly
selected one is pretty bulky. Every time we add a new user control to the
project, we have to add some code in the section where we are
loading/unloading.
Is there a more dynamic, more efficient way to...
|
by: moondaddy |
last post by:
I have a c# 3.5 wpf app which uses user controls for data entry screens.
These data entry screens can be nested inside of each. We can also have
several ones open side by side at the same time. All are in a single
window. My challenge is to know when a data entry screen (UC) becomes the
active control, and when the active user control looses focus and when the
next one gets the focus, and so on. When a user control gets or looses...
|
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: 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...
|
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: 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();...
|
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
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
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...
| |