Click here to Skip to main content
16,013,440 members
Home / Discussions / C#
   

C#

 
GeneralList the virual diectories in IIS Pin
Johny Ng28-Mar-05 11:49
Johny Ng28-Mar-05 11:49 
GeneralRe: List the virual diectories in IIS Pin
J4amieC28-Mar-05 22:48
J4amieC28-Mar-05 22:48 
GeneralCrysta Reports problems when update VS 2002 to 2003 Pin
machocr28-Mar-05 8:27
machocr28-Mar-05 8:27 
GeneralUsing the DAO pattern Pin
wweiss125828-Mar-05 7:55
wweiss125828-Mar-05 7:55 
GeneralGetting Size of a Process Pin
Peter Vertes28-Mar-05 6:13
Peter Vertes28-Mar-05 6:13 
GeneralRe: Getting Size of a Process Pin
Peter Vertes28-Mar-05 17:25
Peter Vertes28-Mar-05 17:25 
GeneralUsing WshShell to create shortcut - COMException Pin
DanielBr28-Mar-05 5:13
DanielBr28-Mar-05 5:13 
GeneralEvent Handler and ctrl.Update() questions... Pin
new_phoenix28-Mar-05 4:49
new_phoenix28-Mar-05 4:49 
Question #1: Event Handler External to the Main Form

An application that I am working on requires an eventhandler class stored in another folder separate from the main application form. The problem that this creates is that I have been forced to have two event handler approaches for the controls: one for the event processing and another to manipulate the form controls. I would much rather prefer to combine the two event handlers into one event handler to remove the confusion rather than have to manage two of them.

The reason why I cannot put all of the code thus far into the external event handler is because none of the form objects are available in the external event handler class. In other words, I would need to manipulate elements that are on the form from the external event handler. However, the external event handler does not even permit the keyword "this" to be used, especially when the methods in the external event handler is set to static. If the keyword static is removed, then the keyword "this" works, but only for the elements that are on the external event handler class. I cannot manipulate any of the form elements from the external event handler class.

The first question is: How to I address the main form of the application from the external event handler class. I tried to use:

<br />
frmMainForm frm = new frmMainForm();<br />


but that only created another form. When I tried to manipulate the controls on the form, and the event handler interacted with this "new" form, it caused the form controls to disappear. I suspect that the control disappeared from the original form because it did not know what to do with it, considering that now there was a "new" frmMainForm form. Either that or it actually attempted to move the control from the "original" frmMainForm to the "new" frmMainForm, but I doubt it because that would require some other technologies.

I also used the "using" keyword referencing the namespace of the frmMainForm form. Then where the code required the frmMainForm I tried to reference it with

<br />
   System.Windows.Forms.Form frm =  NameSpaceOfFrmMainForm.frmMainForm.ActiveForm;<br />


but when the program reached this line of code, it only caused the form to become "active" thereby ignoring any of the code following it which attempted to use the form controls from the application's main form. I know that I am missing something. Could somebody kindly explain to me how to address the application's main form from an external event handler class?

Question #2: ctrl.Update()

When drawing a control to the screen in a looping construction of an array, I would like to clean the screen from the previous iteration through the loop. For example:

<br />
System.Drawing.Point pt1 = new ctrl.Location(50, 10);<br />
System.Drawing.Point pt2 = new ctrl.Location(50, 20);<br />
System.Drawing.Point pt3 = new ctrl.Location(50, 30);<br />
System.Drawing.Point pt4 = new ctrl.Location(50, 40);<br />
<br />
Point[] ptArray = {pt1, pt2, pt3, pt4};<br />
foreach (Point pt in ptArray)<br />
{<br />
  ctrl.Location = pt;<br />
  ctrl.Update();<br />
}<br />


The problem is that each time through the array loop, the control displays, but the previous time through the loop is not removed. Is there some kind of Form1.Paint() delegate that could be used to clear the previous control image ghost? I would like the control to appear as if it is moving with an animation effect, but the fact that the previous ctrl.Update() remains on each next time through the loop detracts from the desired result. Would really appreciate some assistance!!!

Confused | :confused: Confused | :confused: Confused | :confused:
Questionhow to make the area of desktop behind this area accesble by user from within this area ? Pin
Sabry190528-Mar-05 3:44
Sabry190528-Mar-05 3:44 
GeneralWindows configuration file Pin
Member 44721728-Mar-05 3:43
Member 44721728-Mar-05 3:43 
GeneralRe: Windows configuration file Pin
Dave Kreskowiak28-Mar-05 5:35
mveDave Kreskowiak28-Mar-05 5:35 
GeneralRe: Windows configuration file Pin
Member 44721728-Mar-05 20:37
Member 44721728-Mar-05 20:37 
GeneralRe: Windows configuration file Pin
Guinness4Strength29-Mar-05 3:17
Guinness4Strength29-Mar-05 3:17 
Questionhow to make an area in the form have an opacity less than the hole form? Pin
Sabry190528-Mar-05 3:42
Sabry190528-Mar-05 3:42 
Questionhow to make users have the ability to make manual resizing for a rectangular or nonrectangular form only from one side of its 4 sides ? Pin
Sabry190528-Mar-05 2:06
Sabry190528-Mar-05 2:06 
Question)how to make users have the ability to make manual resizing for a nonrectangular From ? Pin
Sabry190528-Mar-05 2:04
Sabry190528-Mar-05 2:04 
QuestionDetect the USB device by logical disk name? Pin
delemur28-Mar-05 1:24
delemur28-Mar-05 1:24 
GeneralC# code generation tool Pin
Rizal Alwin28-Mar-05 1:10
sussRizal Alwin28-Mar-05 1:10 
GeneralRe: C# code generation tool Pin
Dave Kreskowiak28-Mar-05 5:26
mveDave Kreskowiak28-Mar-05 5:26 
GeneralVB to C# Pin
abandito28-Mar-05 0:53
abandito28-Mar-05 0:53 
GeneralRe: VB to C# Pin
DavidNohejl28-Mar-05 1:02
DavidNohejl28-Mar-05 1:02 
GeneralRe: VB to C# Pin
abandito28-Mar-05 1:13
abandito28-Mar-05 1:13 
GeneralRe: VB to C# Pin
DavidNohejl28-Mar-05 1:22
DavidNohejl28-Mar-05 1:22 
GeneralRe: VB to C# Pin
abandito28-Mar-05 1:36
abandito28-Mar-05 1:36 
Generalequivalaent of the delphi WITH statement Pin
sephless28-Mar-05 0:46
sephless28-Mar-05 0:46 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.