473,480 Members | 1,798 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

SuspendLayout & ResumeLayout

Good afternoon all,

I am having a little problem using the SuspendLayout & ResumeLayout
functions from a module.

This is the Delegate Declaration in the module:

Public Delegate Sub Delegate_Layout()
Public Delegate_Form_Layout() As Delegate_Layout = _
{ _
AddressOf Form_SuspendLayout, _
AddressOf Form_ResumeLayout _
}

This is the code from the main form:

Public Sub Form_SuspendLayout()
Me.SuspendLayout()
End Sub

Public Sub Form_ResumeLayout()
Me.ResumeLayout()
End Sub

Unfortunately the AddressOf Form_SuspendLayout and AddressOf
Form_ResumeLayout return errors saying that they are not declared.

I tried running the commands straight from the module:

form_main.activeform.suspendlayout

But it returned the following error:

An unhandled exception of type 'System.NullReferenceException' occurred
in Questionnaire - Employment Consultant.exe

Additional information: Object reference not set to an instance of an
object.

Anyhelp that anyone could provide to make this work would be much
appreciated, I really need to run these commands from multiple modules,
not just the Form_Main.VB where they run fine.

Yours sincerely,

Brent McIntyre

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 20 '05 #1
6 8737
"Brent McIntyre" <br************@aep.salvationarmy.org> schrieb
Good afternoon all,

I am having a little problem using the SuspendLayout &
ResumeLayout functions from a module.

This is the Delegate Declaration in the module:

Public Delegate Sub Delegate_Layout()
Public Delegate_Form_Layout() As Delegate_Layout = _
{ _
AddressOf Form_SuspendLayout, _
AddressOf Form_ResumeLayout _
}

This is the code from the main form:

Public Sub Form_SuspendLayout()
Me.SuspendLayout()
End Sub

Public Sub Form_ResumeLayout()
Me.ResumeLayout()
End Sub

Unfortunately the AddressOf Form_SuspendLayout and AddressOf
Form_ResumeLayout return errors saying that they are not declared.

I tried running the commands straight from the module:

form_main.activeform.suspendlayout
Is Form_main the Form displayed? If it is: I think that form_main does not
contain another Form, consequently ActiveForm is Nothing (=> error).

But it returned the following error:

An unhandled exception of type 'System.NullReferenceException'
occurred in Questionnaire - Employment Consultant.exe

Additional information: Object reference not set to an instance of
an object.


<default answer>
If you want to access an object you need a reference. If you don't have a
reference you have to make it available. Where when and how depends on the
strcuture of your application.
</default answer>

--
Armin

http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html

Nov 20 '05 #2
"Armin Zingler" <az*******@freenet.de> schrieb
I tried running the commands straight from the module:

form_main.activeform.suspendlayout


Is Form_main the Form displayed? If it is: I think that form_main
does not contain another Form, consequently ActiveForm is Nothing (=>
error).


I wrote garbage, sorry. ActiveForm is a shared property (MSFT, please make
it (optionally) unavailable with object references!!!). Writing
form_main.activeform
is actually writing
System.Windows.Forms.Form.activeform

--
Armin

http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html

Nov 20 '05 #3
Armin,

Thanks for you help, just to follow up though. The form 'Form_Main'
does not contain or link to any other forms, but the default for
accessing Suspend/Resume Layout is 'Form.ActiveForm.SuspendLayout()' so
I can not do it another way, can I ? I may be missing something, I
usually do. Secondly, I have fully referenced (Once again I may be
missing something) as seen in the previous description, but it still
will not work, I am thinking that you may not be able to use this type
of method through delegates, once again I am not sure.

Thanks for your help, if you have any further feedback it would be
greatly appreciated.

Yours sincerely,

Brent McIntyre

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 20 '05 #4
Armin,

I am going crazy over this problem, any further help you may be able to
provide would be much appreciated.

If I try to use a delegate ie:

Module Code

Public Delegate Sub Delegate_Layout()
Public Delegate_Layout_Selection() As Delegate_Layout = _
{ _
AddressOf Update_Negative, _
AddressOf Update_Positive _
}

Form_Main.vb Code

Public Sub Update_Negative()

'Me.SuspendLayout()

End Sub

Public Sub Update_Positive()

'Me.ResumeLayout()

End Sub

then it can't find Update_Negative/Positive unless they are on another
Module. Does this mean I am not referencing the Form_Main.vb properley
?

If I try to put them in to an array loaded from a module, ie

Form_Main.vb Code

Load_001(me.suspendlayout, _
me.resumelayout)

Module Code

Public Update_Array(1) as control

Public Sub Load_001(ByVal Update_Negative as Control, _
ByVal Update_Positive as Control)

update_array(0) = Update_Negative
update_array(1) = Update_Positive

End Sub

then it can't understand the load_001 part as there seems to be a
problem with calling it a Control even though that is what Help tells me
it is, this is really driving me crazy it is the last part of a project
I need to do, without it the program looks terrible as it updates nearly
two hundred panels.

Any help you may be able to provide would be much appreciated.

Yours sincerely,

Brent McIntyre

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 20 '05 #5
On Wed, 19 Nov 2003 05:13:10 -0800, Brent McIntyre wrote:
AddressOf Update_Negative, _
AddressOf Update_Positive _


How does the AddressOf know where to find the methods? Would it be more
appropriate to use:

AddressOf Form_Main.Update_Negative, _
AddressOf Form_Main.Update_Positive

Where Form_Main is an instance of the form in question?

I'm not sure what you are attempting to accomplish, though.
--
Chris

To send me an E-mail, remove the underscores and lunchmeat from my E-Mail
address.
Nov 20 '05 #6
"Brent McIntyre" <br************@aep.salvationarmy.org> schrieb
[...]

Any help you may be able to provide would be much appreciated.


Sorry, I read the whole post but I can not follow you. Why do you need a
module at all?
--
Armin

http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html

Nov 20 '05 #7

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

Similar topics

1
11412
by: DrTebi | last post by:
Hello, I have the following problem: I used to "encode" my email address within links, in order to avoid (most) email spiders. So I had a link like this: <a...
0
2399
by: Thomas Scheffler | last post by:
Hi, I runned in trouble using XALAN for XSL-Transformation. The following snipplet show what I mean: <a href="http://blah.com/?test=test&amp;test2=test2">Test1&amp;</a> <a...
0
1571
by: Brent McIntyre | last post by:
Good evening all, I am having a little (HUGE ACTUALLY) problem using the SuspendLayout & ResumeLayout functions from a module. DELEGATE PROBLEM This is the code from the Module_Data:...
4
3199
by: johkar | last post by:
When the output method is set to xml, even though I have CDATA around my JavaScript, the operaters of && and < are converted to XML character entities which causes errors in my JavaScript. I know...
1
3636
by: 2G | last post by:
Hi, I've a usercontrol that fills a listview with data from my db, I had this.SuspendLayout() in the beginning and this.ResumeLayout at the end of the function that loads the data and all worked...
14
5902
by: Arne | last post by:
A lot of Firefox users I know, says they have problems with validation where the ampersand sign has to be written as &amp; to be valid. I don't have Firefox my self and don't wont to install it only...
0
3991
by: Gwl | last post by:
I have a DataGridView and following code: private void button1_Click(object sender, EventArgs e) { dataGridView1.ColumnCount = 365; } When I click on the button it is extremely slow (some...
1
2966
by: =?Utf-8?B?RXRoYW4gU3RyYXVzcw==?= | last post by:
Hi, I was just about to wrap some code for filling a DataViewGrid in grid.SuspendLayout(); //Grid filling code grid.ResumeLayout(); when I got worried t hat something might go wrong in the...
1
3188
by: timor.super | last post by:
Hi all, I've read that if i have to add many item to my listview/treeview/... I can use SuspendLayout or BeginUpdate and after resume with ResumeLayout or EndUpdate But I don't understand...
0
7037
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
6904
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...
0
7032
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,...
0
6873
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...
1
4767
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
2990
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
2976
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1294
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 ...
0
174
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...

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.